oops / slim-nette-bridge
Slim Framework bridge for Nette DI.
Installs: 13 690
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >= 7.1.0
- nette/di: ^3.0
- nette/utils: ^3.0
- psr/container: 1.0
- slim/slim: ^3.0
Requires (Dev)
- nette/bootstrap: ^3.0
- nette/tester: ^2.2
This package is auto-updated.
Last update: 2020-10-25 13:44:27 UTC
README
This package helps you quickly build a Slim Framework application, utilizing the power of Nette DI container.
THIS PACKAGE IS NO LONGER MAINTAINED!
As suggested in #6, you can use slimapi/slimapi instead.
Installation and requirements
$ composer require oops/slim-nette-bridge
Oops/SlimNetteBridge requires PHP >= 7.1.
Usage
Register the extension in your config file.
extensions: slim: Oops\SlimNetteBridge\DI\SlimExtension(%debugMode%)
Then configure it:
slim: settings: addContentLengthHeader: false configurators: - App\MyConfigurator
settings
section can be used to override Slim's default settings;configurators
is a list ofApplicationConfigurator
implementations which, in the same order as defined in the list, can add routes and middlewares to the instance ofSlim\App
.
Once you have configured the bridge, you can create a simple index.php
script in your document root, using nette/bootstrap
to build the container:
<?php // include Composer autoloader require_once __DIR__ . '/path/to/vendor/autoload.php'; // configure and create the DI container $configurator = new Nette\Configurator(); $configurator->setTempDirectory(__DIR__ . '/path/to/temp'); $configurator->addConfig(__DIR__ . '/path/to/config.neon'); $container = $configurator->createContainer(); // run the configured Slim application $container->getByType(Slim\App::class)->run();
Don't forget to configure your web server to pass the incoming requests to the index.php
script.