Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
4d69d075
Commit
4d69d075
authored
Sep 22, 2011
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some class names in the doc
parent
41639536
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
doc/providers.rst
doc/providers.rst
+19
-19
No files found.
doc/providers.rst
View file @
4d69d075
...
@@ -17,12 +17,12 @@ application::
...
@@ -17,12 +17,12 @@ application::
$app = new Silex\Application();
$app = new Silex\Application();
$app->register(new Acme\DatabaseProvider());
$app->register(new Acme\Database
Service
Provider());
You can also provide some parameters as a second argument. These
You can also provide some parameters as a second argument. These
will be set **before** the provider is registered::
will be set **before** the provider is registered::
$app->register(new Acme\DatabaseProvider(), array(
$app->register(new Acme\Database
Service
Provider(), array(
'database.dsn' => 'mysql:host=localhost;dbname=myapp',
'database.dsn' => 'mysql:host=localhost;dbname=myapp',
'database.user' => 'root',
'database.user' => 'root',
'database.password' => 'secret_root_password',
'database.password' => 'secret_root_password',
...
@@ -61,16 +61,16 @@ Included providers
...
@@ -61,16 +61,16 @@ Included providers
There are a few provider that you get out of the box.
There are a few provider that you get out of the box.
All of these are within the ``Silex\Provider`` namespace.
All of these are within the ``Silex\Provider`` namespace.
* :doc:`DoctrineProvider <providers/doctrine>`
* :doc:`Doctrine
Service
Provider <providers/doctrine>`
* :doc:`MonologProvider <providers/monolog>`
* :doc:`Monolog
Service
Provider <providers/monolog>`
* :doc:`SessionProvider <providers/session>`
* :doc:`Session
Service
Provider <providers/session>`
* :doc:`SwiftmailerServiceProvider <providers/swiftmailer>`
* :doc:`SwiftmailerServiceProvider <providers/swiftmailer>`
* :doc:`SymfonyBridgesServiceProvider <providers/symfony_bridges>`
* :doc:`SymfonyBridgesServiceProvider <providers/symfony_bridges>`
* :doc:`TwigProvider <providers/twig>`
* :doc:`Twig
Service
Provider <providers/twig>`
* :doc:`TranslationProvider <providers/translation>`
* :doc:`Translation
Service
Provider <providers/translation>`
* :doc:`UrlGeneratorProvider <providers/url_generator>`
* :doc:`UrlGenerator
Service
Provider <providers/url_generator>`
* :doc:`ValidatorProvider <providers/validator>`
* :doc:`Validator
Service
Provider <providers/validator>`
* :doc:`HttpCacheProvider <providers/http_cache>`
* :doc:`HttpCache
Service
Provider <providers/http_cache>`
Creating a provider
Creating a provider
~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~
...
@@ -94,7 +94,7 @@ Here is an example of such a provider::
...
@@ -94,7 +94,7 @@ Here is an example of such a provider::
use Silex\Application;
use Silex\Application;
use Silex\ServiceProviderInterface;
use Silex\ServiceProviderInterface;
class HelloProvider implements ServiceProviderInterface
class Hello
Service
Provider implements ServiceProviderInterface
{
{
public function register(Application $app)
public function register(Application $app)
{
{
...
@@ -116,7 +116,7 @@ You can now use this provider as follows::
...
@@ -116,7 +116,7 @@ You can now use this provider as follows::
$app = new Silex\Application();
$app = new Silex\Application();
$app->register(new Acme\HelloProvider(), array(
$app->register(new Acme\Hello
Service
Provider(), array(
'hello.default_name' => 'Igor',
'hello.default_name' => 'Igor',
));
));
...
@@ -133,8 +133,8 @@ Class loading
...
@@ -133,8 +133,8 @@ Class loading
~~~~~~~~~~~~~
~~~~~~~~~~~~~
Providers are great for tying in external libraries as you
Providers are great for tying in external libraries as you
can see by looking at the ``MonologProvider`` and
can see by looking at the ``Monolog
Service
Provider`` and
``TwigProvider``. If the library is decent and follows the
``Twig
Service
Provider``. If the library is decent and follows the
`PSR-0 Naming Standard <http://groups.google.com/group/php-standards/web/psr-0-final-proposal>`_
`PSR-0 Naming Standard <http://groups.google.com/group/php-standards/web/psr-0-final-proposal>`_
or the PEAR Naming Convention, it is possible to autoload
or the PEAR Naming Convention, it is possible to autoload
classes using the ``UniversalClassLoader``.
classes using the ``UniversalClassLoader``.
...
@@ -149,7 +149,7 @@ Here is an example of how to use it (based on `Buzz <https://github.com/kriswall
...
@@ -149,7 +149,7 @@ Here is an example of how to use it (based on `Buzz <https://github.com/kriswall
use Silex\Application;
use Silex\Application;
use Silex\ServiceProviderInterface;
use Silex\ServiceProviderInterface;
class BuzzProvider implements ServiceProviderInterface
class Buzz
Service
Provider implements ServiceProviderInterface
{
{
public function register(Application $app)
public function register(Application $app)
{
{
...
@@ -164,7 +164,7 @@ Here is an example of how to use it (based on `Buzz <https://github.com/kriswall
...
@@ -164,7 +164,7 @@ Here is an example of how to use it (based on `Buzz <https://github.com/kriswall
This allows you to simply provide the class path as an
This allows you to simply provide the class path as an
option when registering the provider::
option when registering the provider::
$app->register(new BuzzProvider(), array(
$app->register(new Buzz
Service
Provider(), array(
'buzz.class_path' => __DIR__.'/vendor/buzz/lib',
'buzz.class_path' => __DIR__.'/vendor/buzz/lib',
));
));
...
@@ -185,7 +185,7 @@ controllers under a path::
...
@@ -185,7 +185,7 @@ controllers under a path::
$app = new Silex\Application();
$app = new Silex\Application();
$app->mount('/blog', new Acme\BlogProvider());
$app->mount('/blog', new Acme\Blog
Controller
Provider());
All controllers defined by the provider will now be available under the
All controllers defined by the provider will now be available under the
`/blog` path.
`/blog` path.
...
@@ -207,7 +207,7 @@ Here is an example of such a provider::
...
@@ -207,7 +207,7 @@ Here is an example of such a provider::
use Silex\Application;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Silex\ControllerProviderInterface;
class HelloProvider implements ControllerProviderInterface
class Hello
Controller
Provider implements ControllerProviderInterface
{
{
public function connect(Application $app)
public function connect(Application $app)
{
{
...
@@ -233,7 +233,7 @@ You can now use this provider as follows::
...
@@ -233,7 +233,7 @@ You can now use this provider as follows::
$app = new Silex\Application();
$app = new Silex\Application();
$app->connect('/blog', new Acme\HelloProvider());
$app->connect('/blog', new Acme\Hello
Controller
Provider());
In this example, the ``/blog/`` path now references the controller defined in
In this example, the ``/blog/`` path now references the controller defined in
the provider.
the provider.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment