crystoline / xpsr-framework
XPSR framework library: application lifecycle, PSR-11 container, PSR-15 HTTP kernel, routing contracts, providers, and console
Requires
- php: ^8.4
- composer-runtime-api: ^2.2
- illuminate/config: ^12.0
- nyholm/psr7-server: ^1.1
- psr/clock: ^1.0
- psr/container: ^2.0
- psr/event-dispatcher: ^1.0
- psr/http-factory: ^1.1
- psr/http-factory-implementation: ^1.0
- psr/http-message: ^1.1 || ^2.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- psr/log: ^3.0
- symfony/clock: ^7.4
- symfony/console: ^7.4
- symfony/finder: ^7.4
- symfony/process: ^7.4
- vlucas/phpdotenv: ^5.6.1
Requires (Dev)
- filp/whoops: ^2.18.4
- nyholm/psr7: ^1.8.2
- phpunit/phpunit: ^12.5
- symfony/http-kernel: ^7.4
- twig/twig: ^3.4
Suggests
- ext-openssl: Needed to encrypt with app.key (Crystoline\Xpsr\Encryption\Encrypter)
- crystoline/xpsr-router-fastroute: Default router adapter
- crystoline/xpsr-router-sunrise: Alternative router adapter
- filp/whoops: Detailed HTML error pages when APP_DEBUG=true (development only)
- phpunit/phpunit: Needed to run Crystoline\Xpsr\Testing\RouterContractTestCase in an adapter's own tests
- twig/twig: Needed to render views with the view() helper and ViewServiceRegistry
Provides
None
Conflicts
- symfony/var-dumper: <7.4
Replaces
None
README
The XPSR framework library: application lifecycle and configuration, the PSR-11 container and provider lifecycle, the PSR-15 HTTP kernel and middleware, portable route definitions and the router contract, error rendering and PSR-3 logging, the response emitter, the PSR-14 event dispatcher, sessions with CSRF protection and their file store, authentication (session sign-in, guards, password hashing) and policies, encryption with APP_KEY in Laravel's format, and the xpsr console with its generators and setup command.
It does not include a router implementation. Install an adapter alongside it:
| Adapter | Package | ROUTER_ADAPTER |
|---|---|---|
| FastRoute (default) | crystoline/xpsr-router-fastroute |
fastroute |
| Sunrise | crystoline/xpsr-router-sunrise |
sunrise |
Most applications start from the crystoline/xpsr skeleton instead of requiring this package directly. Documentation lives in the XPSR repository's docs/ directory.
Writing a router adapter
Implement Crystoline\Xpsr\Contracts\Routing\RouterInterface, usually by extending Crystoline\Xpsr\Routing\AbstractRouter. Then prove it with the shared contract suite: extend Crystoline\Xpsr\Testing\RouterContractTestCase in your tests and return your router from createRouter(). The suite needs phpunit/phpunit and nyholm/psr7 as development dependencies.
Tests
composer install vendor/bin/phpunit
Requires PHP 8.4+.