sauber-php / framework
The Sauber PHP framework
Fund package maintenance!
juststeveking
Requires
- php: ^8.1
- psr/container: ^2.0
- sauber-php/container: dev-main
- sauber-php/http: dev-main
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- pestphp/pest: ^1.21
- phpstan/phpstan: ^1.7
This package is not auto-updated.
Last update: 2024-12-24 18:57:04 UTC
README
Sauber PHP Framework
This is the repository for the Sauber PHP Framework.
Installation
You should not need to install this package, you should use the sauber-php/sauber
template instead, but if you would
like to manually build your template, please install using composer:
composer require sauber-php/framework
Usage
To use this package outside of the template, you will need to instantiate it yourself.
Using the Applications static boot method
use Sauber\Framework\Application; use Sauber\Container\Container; $app = Application::boot( container: new Container(), ); // Register routes here ... $app->run();
Manually creating the Application
use Sauber\Container\Container; use Sauber\Framework\Application; use Sauber\Http\HttpKernel; use Sauber\Http\Router; $container = new Container(); $router = new Router( container: $container, ); $app = new Application( router: $router, kernel: HttpKernel::using( router: $router, ), container: $container, ); // Register routes here ... $app->run();
Using the dispatch method
use Sauber\Container\Container; use Sauber\Framework\Application; use Sauber\Http\Request; $app = Application::boot( container: new Container(), ); // Register routes here ... $app->dispatch( request: Request::capture(), );
Testing
To run the tests:
./vendor/bin/pest
Static Analysis
To check the static analysis:
./vendor/bin/phpstan analyse
Changelog
Please see the Changelog for more information on what has changed recently.