sauber-php / container
The Container component for the Sauber PHP framework
Fund package maintenance!
juststeveking
Installs: 47
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sauber-php/container
Requires
- php: ^8.1
- league/container: ^4.2
- psr/container: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- pestphp/pest: ^1.21
- phpstan/phpstan: ^1.7
This package is not auto-updated.
Last update: 2025-09-28 02:40:53 UTC
README
Container
This is the repository for the DI Container used in the Sauber PHP Framework.
Installation
You should not need to install this package, as it comes pre-installed with the Sauber PHP Framework, however if you want to use this outside of the framework please use composer:
composer require sauber-php/container
Usage
To use the container, you can manually add definitions:
$container = new Container( definitions: [ UserRepositoryInterface::class => UserRepository::class, ], ); $repository = $container->get( id: UserRepositoryInterface::class, );
To make a new container with injected callables:
$injectors = [ UserRepositoryInterface::class => UserRepository::class, ]; $container = Container::make( injectors: $injectors, ); $repository = $container->get( id: UserRepositoryInterface::class, );
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.