Skip to content

Thanks to the effort of @radimvaculik in #5, this release supports (in fact, requires) Nette 3.0 🎉

Assets 2

@jiripudil jiripudil released this Nov 30, 2017 · 1 commit to master since this release

We developers are lazy, and so should be our applications. ApplicationConfigurators can now register not only callbacks, but also service types directly. This means that where you formerly wrote

namespace My\App;
class Configurator implements ApplicationConfigurator
{
    private $controller;
    public function __construct(Controller $controller)
    {
        $this->controller = $controller;
    }

    public function configureApplication(Slim\App $app)
    {
        $app->get('/route', $this->controller);
    }
}

you can now write

namespace My\App;
class Configurator implements ApplicationConfigurator
{
    public function configureApplication(Slim\App $app)
    {
        $app->get('/route', Controller::class);
    }
}

The Controller is automatically fetched from the DI container as long as it is registered as a service. This way you can optimize your applications because dependencies are not instantiated unnecessarily.

If you don't use invokable classes and want to point to a specific method of the class, you can write

namespace My\App;
class Configurator implements ApplicationConfigurator
{
    public function configureApplication(Slim\App $app)
    {
        $app->get('/route', Controller::class . ':method');
    }
}
Assets 2

@jiripudil jiripudil released this Sep 20, 2017 · 4 commits to master since this release

After some time in production, I think this package is ready for a stable release. This release includes a fix in the internals which prevents conflicts between unprefixed services in the DI container, see #1. As a result, SlimNetteBridge uses its own implementation of the PSR-11 container interface, and therefore providing such implementation from your code is no longer necessary.

Assets 2
You can’t perform that action at this time.