Permalink
Browse files

fixed doc on service providers

  • Loading branch information...
1 parent 27979a2 commit 0731e0c984d6b807701ca097201044e4ccda85c7 @fabpot fabpot committed May 30, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 doc/providers.rst
View
@@ -77,11 +77,15 @@ Providers must implement the ``Silex\ServiceProviderInterface``::
interface ServiceProviderInterface
{
function register(Application $app);
+
+ function boot(Application $app);
}
-This is very straight forward, just create a new class that implements the
-``register`` method. In this method you must define services on the
-application which then may make use of other services and parameters.
+This is very straight forward, just create a new class that implements the two
+methods. In the ``register()`` method, you can define services on the
+application which then may make use of other services and parameters. In the
+``boot()`` method, you can configure the application, just before it handles a
+request.
Here is an example of such a provider::
@@ -101,6 +105,10 @@ Here is an example of such a provider::
return 'Hello '.$app->escape($name);
});
}
+
+ public function boot(Application $app)
+ {
+ }
}
This class provides a ``hello`` service which is a protected closure. It takes

0 comments on commit 0731e0c

Please sign in to comment.