Commit 96574213 authored by guillemc's avatar guillemc

Add example of JsonUserPersister being managed

parent 59e7dbd3
...@@ -143,6 +143,15 @@ those definitions. ...@@ -143,6 +143,15 @@ those definitions.
This also works for shared services. This also works for shared services.
Going back to our initial example, here's how we could use the container
to manage its dependencies::
$app['user.persist_path'] = '/tmp/users';
$app['user.persister'] = $app->share(function ($app) {
return new JsonUserPersister($app['user.persist_path']);
});
Protected closures Protected closures
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment