dev-master
9999999-devPrivate scope handling for Silex container
MIT
The Requires
The Development Requires
0.1
0.1.0.0Private scope handling for Silex container
MIT
The Requires
The Development Requires
Wallogit.com
2017 © Pedro Peláez
Private scope handling for Silex container
Create an instance of ScopedApplication to hide your services by default:, (*1)
$app = new Nassau\Silex\ScopedApplication([
'version' => 1.0,
]);
$app['private-service'] = function () { };
$app['version']; // 1.0; services are registered as public if passed to constructor
$app['private-service']; // throws \Nassau\Silex\PrivateScopeViolationException
Create a public service by using publish() method. Private services will be available from inside the closure:, (*2)
$app = new Nassau\Silex\ScopedApplication;
$app['public-service'] = $app->publish(function (Silex\Application $app) {
return $app['private-service'];
});
$app['private-service'] = function () { return "private" }
$app['public-service']; // "private";
Private scope handling for Silex container
MIT
Private scope handling for Silex container
MIT