Download the PHP package prsw/amphp-bundle without Composer

On this page you can find all versions of the php package prsw/amphp-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package amphp-bundle

AmphpBundle

Replaces PHP-FPM with a long-running async HTTP server for Symfony. All I/O is non-blocking and fiber-based. No more PHP-FPM process overhead.

Features

Quick Start

1. Install

Register the bundle if you are not using symfony flex in config/bundles.php:

2. Start the Server

Press Ctrl+C to stop.

3. Add a WebSocket Endpoint

Create a class with the #[WebsocketEndpoint] attribute — no YAML needed:

The bundle auto-discovers #[WebsocketEndpoint] handlers at startup.

CLI Options

Option Short Description Default
--workers -w Number of worker processes CPU count
--max-requests -r Requests per worker before restart 1000
--host Bind address 127.0.0.1
--port -p Bind port 8080
--shutdown-timeout -t Drain timeout (seconds) 1
--dev Single worker, --env=dev, --debug=true
--watch File watcher + auto-restart (needs --dev)

Configuration

DBAL pool settings from amphp.dbal are automatically wired into Doctrine's driverOptions. Keep max_connections below your MySQL server's limit (SHOW VARIABLES LIKE 'max_connections'; default 151).

Per-Request Cleanup (Priority Reset System)

After each request, the bundle runs a chain of resetters to release resources and prevent state leaking between requests. Built-in resetters handle the Doctrine connection pool and debug logger; you can add your own via PriorityResetInterface.

How It Works

  1. SymfonyRequestHandler calls RequestResetter::reset() in the finally block.
  2. RequestResetter sorts all tagged services by priority (highest first) and calls reset() on each.
  3. Built-in priorities:
    • User-defined — -255 to 255 (your custom resetters)
    • DebugLoggerResetter — -255 (clears debug logs)

Adding a Custom Resetter

Create a class implementing PriorityResetInterface:

That's it — no manual tagging or service registration needed. The bundle's BootstrapIntegrationPass auto-configures any service implementing PriorityResetInterface with the amphp.resetter tag, and RequestResetter discovers it automatically via the tagged iterator.

Execution Order

Higher priority numbers run first. Use the built-in constants as anchor points:

Priority Resetter When it runs
50 User example Custom pool release
0 User example General-purpose cleanup
-255 DebugLoggerResetter Clear debug logs (last)

Real-World Use Cases

Built-in Endpoints

Path Type Description
/healthz AMPHP middleware Returns {"status":"alive"} — no Symfony boot
/readyz Symfony route Full-stack readiness check
/metrics Symfony route Prometheus metrics
user-defined WebSocket #[WebsocketEndpoint] handlers

Benchmarks

Results with wrk -t1 -c100 -d30s, 1 worker, APP_ENV=prod, APP_DEBUG=0:

Endpoint Requests/s Avg Latency Description
/twig-test 1,446 69 ms Twig template render, no DB
/products 392 254 ms Doctrine DBAL query + Twig render (15 rows)

Compared to PHP-FPM with the same Symfony app, the async server eliminates the PHP-FPM process spawn overhead and connection pool contention, yielding higher throughput under concurrent load.

SSE Streaming

Generator-Based Streaming

Prometheus Metrics

Implement MetricCollectorInterface (autotagged amphp.metric_collector):

Optional Integrations

Feature Packages
Async Doctrine (MySQL/PostgreSQL) amphp/mysql + doctrine/orm
Async Redis cache / sessions / messenger amphp/redis
Async Mailer (SMTP + HTTP) symfony/mailer + amphp/http-client
WebSocket server included with the bundle
Hot reload (--watch) fswatch (system package)

All versions of amphp-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-pcntl Version *
ext-posix Version *
symfony/dotenv Version ^8.0
symfony/http-kernel Version ^8.0
symfony/http-foundation Version ^8.0
amphp/http-server Version ^3.0
amphp/http-server-form-parser Version ^2.0
amphp/http-server-router Version ^2.0
amphp/http-server-static-content Version ^2.0
amphp/websocket-server Version ^4.0
amphp/socket Version ^2.0
amphp/cluster Version ^2.0
amphp/file Version ^3.2
psr/log Version ^3.0
monolog/monolog Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package prsw/amphp-bundle contains the following files

Loading the files please wait ...