p7v / illuminate-container-slim-bridge
Illuminate (Laravel) Container integration in Slim
Installs: 50
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/p7v/illuminate-container-slim-bridge
Requires
- php: ^7.3 || ~8.0.0 || ~8.1.0
- illuminate/container: ^7.23 || ^8.0
- php-di/invoker: ^2.0
- slim/slim: ^4.2.0
Requires (Dev)
- vimeo/psalm: ^4.6
This package is auto-updated.
Last update: 2025-09-29 02:51:38 UTC
README
This package configures Slim to work with the Illuminate container. By default, container supports autowiring.
Install
composer require p7v/illuminate-container-slim-bridge
Minimal setup
Instead of using the official Slim\Factory\AppFactory, use Bridge class to create your application:
<?php require 'vendor/autoload.php'; $app = \P7v\IlluminateContainerSlim\Bridge::create();
Setup with preconfigured container
If you need to configure the container beforehand, pass your configured container to the method:
<?php require 'vendor/autoload.php'; $container = new \Illuminate\Container\Container(); /** Configure your container */ $app = \P7v\IlluminateContainerSlim\Bridge::create($container);
Configure container using service providers
You can use service providers for container configuration. Your service provider has to extend P7v\IlluminateContainerSlim\ServiceProvider. Then provide list of names of your service providers to usingProviders method in Bridge.
class AppServiceProvider extends \P7v\IlluminateContainerSlim\ServiceProvider { public function register(): void { $this->bind('key', function () { return new stdClass(); }); $this->singleton(RepositoryInterface::class, Repository::class); } }
<?php require 'vendor/autoload.php'; $providers = [ AppServiceProvider::class, ]; $app = \P7v\IlluminateContainerSlim\Bridge::usingProviders($providers);