vlucas / bulletphp

A resource-oriented micro PHP framework
http://bulletphp.com
BSD 3-Clause "New" or "Revised" License
418 stars 50 forks source link

'Method 'Bullet\App::share' not found' #72

Closed TheNemus closed 7 years ago

TheNemus commented 9 years ago

Apache gives me this while trying to do some DI:

$app = new Bullet\App(); $app['config'] = $app->share(function() {

return array(
    "database" => array(
        "username" => "root",
        "pwd" => "",
        "host" => "localhost"
    )
);

});

twocore commented 8 years ago

Since Bullet uses Pimple as DI container, you can use the following format:

$app['config'] = function() {
    return [
        // ... your configuration
    ]
};

The [ ... ] is the short syntax for array() in PHP >= 5.4!

You can find more infos about pimple by reading the documentation: https://github.com/silexphp/Pimple/blob/master/README.rst

sbditto85 commented 8 years ago

The share function comes from Pimple 1.x but bullet now seems to use Pimple 3.x which defaults the the behavior of calling share. So you don't need it anymore.