The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

SlimFramework Pimple Vs Container for Dependency Injection (DI)

D. Marqu's Avatar

D. Marqu

03 Jun, 2015 12:07 PM

Brian's Post - 2012 on Nesbot.com was pretty using Pimple
ie.

$pimple = new Pimple();
$pimple['app'] = $app;
$pimple['UserController'] = $pimple->share(function ($pimple) {
    echo 'Created UserController';
    return new UserController($pimple);
});

But Allen's Post - 2015 on Akrabat.com, shows straight forward implementation of Slim's Container.

$app->container->set('foobar', function() { return new Foo\Bar(); } );
$fooBar = $app->foobar;

I am not sure whether it is wise decision to stick on Pimple.
Cheers !

  1. Support Staff 1 Posted by Andrew Smith on 03 Jun, 2015 04:41 PM

    Andrew Smith's Avatar

    There is no sticking on Pimple in Rob's post. Slim has its own Dependency Injection Container (DiC) for v2, we have however removed that for v3 and use third party dependency instead which can be changed to any DiC that is based on the container interop if you wish to change it.

  2. 2 Posted by D. Marqu on 04 Jun, 2015 03:22 PM

    D. Marqu's Avatar

    Thanks for making me ready for v3.
    Got overview of V3 on
    http://www.slimframework.com/2015/02/11/whats-up-with-version-3.html

    Satisfied for the topic.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac