A Rust application server for PHP.
Rapira website · Rapira documentation · Rapira quickstart · Rapira releases
Rapira is a Rust application server for PHP. The maintainers of RoadRunner develop Rapira. It uses the PHP embed SAPI to load non-thread-safe (NTS) PHP in the server process. Rapira calls the PHP interpreter directly. It does not use FastCGI, a socket between Rapira and PHP, or per-request serialization. Plugins extend Rapira.
Rapira has three execution modes:
- Classic mode runs the front controller for each request. It can replace
php-fpmfor an existing PHP application. The application does not need code changes. - Worker mode keeps the application in memory. Rapira initializes the application one time for each worker and calls a handler for each request.
- Dispatcher mode keeps the application in memory. It gives each HTTP request to the application as a
Rapira\Http\Exchangeobject. Dispatcher is the default mode.
Rapira release packages and tar archives include NTS PHP. You do not need to install PHP separately. Use the download page to select a file for your operating system, processor architecture, PHP version, and package format. Verify the file before installation. Follow the installation guide.
After installation, start an existing application in Classic mode:
rapira serve --mode classic public/index.phpRelease packages and tar archives contain a fixed set of PHP extensions. See the current extension list. If your application needs other extensions, build a compatible NTS libphp with the required extensions. You do not need to rebuild Rapira.
Use the ghcr.io/rapira-rs/rapira:php8.4 or ghcr.io/rapira-rs/rapira:php8.5 container image. Each image uses scratch as its base. Rapira does not publish a latest tag. The image contains Rapira and libphp.so. It cannot run by itself. Copy its files into your application image. See the Docker instructions.
For more information, see the quickstart, Worker mode guide, and framework guides for Symfony, Laravel, and Yii 3.
- The rapira repository contains the Rust server core and its integration with the PHP embed SAPI.
- The sdk-php repository contains PSR-7 request factories and test utilities. The project publishes each SDK component as a separate Composer package.
- The yii-runner-rapira repository contains the Yii 3 application runner for Worker mode.
- The rapira-rs.github.io repository contains the source for the rapira.rs documentation site.
Open PHP SDK issues in the sdk-php issue tracker. Open all other issues in the Rapira issue tracker. See the Rapira contribution guide for build and test instructions.