https://github.com/o2ps/slimnettebridge
Slim Framework bridge for Nette DI
https://github.com/o2ps/slimnettebridge
nette-framework slim-framework slim3
Last synced: 4 months ago
JSON representation
Slim Framework bridge for Nette DI
- Host: GitHub
- URL: https://github.com/o2ps/slimnettebridge
- Owner: o2ps
- License: bsd-3-clause
- Created: 2017-06-27T14:29:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-25T13:44:23.000Z (over 5 years ago)
- Last Synced: 2025-01-31T07:05:29.580Z (about 1 year ago)
- Topics: nette-framework, slim-framework, slim3
- Language: PHP
- Size: 19.5 KB
- Stars: 11
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Oops/SlimNetteBridge
[](https://travis-ci.org/o2ps/SlimNetteBridge)
[](https://packagist.org/packages/oops/slim-nette-bridge)
[](https://packagist.org/packages/oops/slim-nette-bridge)
This package helps you quickly build a [Slim Framework](https://www.slimframework.com) application, utilizing the power of [Nette DI container](https://github.com/nette/di).
## THIS PACKAGE IS NO LONGER MAINTAINED!
As suggested in [#6](https://github.com/o2ps/SlimNetteBridge/issues/6), you can use [slimapi/slimapi](https://github.com/slimapi/slimapi) instead.
## Installation and requirements
```bash
$ composer require oops/slim-nette-bridge
```
Oops/SlimNetteBridge requires PHP >= 7.1.
## Usage
Register the extension in your config file.
```yaml
extensions:
slim: Oops\SlimNetteBridge\DI\SlimExtension(%debugMode%)
```
Then configure it:
```yaml
slim:
settings:
addContentLengthHeader: false
configurators:
- App\MyConfigurator
```
- `settings` section can be used to override Slim's [default settings](https://www.slimframework.com/docs/objects/application.html#slim-default-settings);
- `configurators` is a list of `ApplicationConfigurator` implementations which, in the same order as defined in the list, can add routes and middlewares to the instance of `Slim\App`.
Once you have configured the bridge, you can create a simple `index.php` script in your document root, using [`nette/bootstrap`](https://github.com/nette/bootstrap) to build the container:
```php
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.