Commit 5dcf618d authored by Igor Wiedler's avatar Igor Wiedler

[docs] several small adjustments

parent 628714a2
......@@ -14,6 +14,10 @@ steps.
* Send a pull request. Bonus points for topic branches.
If you have a big change or would like to discuss something,
please join us on the `mailing list
<http://groups.google.com/group/silex-php>`.
.. note::
Any code you contribute must be licensed under the MIT
......
......@@ -105,7 +105,7 @@ or the PEAR Naming Convention, it is possible to autoload
classes using the ``UniversalClassLoader``.
As described in the *Services* chapter, there is an
*autoloader* service that you can use for this.
*autoloader* service which can be used for this.
Here is an example of how to use it (based on `Buzz <https://github.com/kriswallsmith/Buzz>`_)::
......
......@@ -24,14 +24,14 @@ Parameters
Services
--------
* **twig**: The ``Twig_Environment`` instance, you will only
need to use this.
* **twig**: The ``Twig_Environment`` instance. The main way of
interacting with Twig.
* **twig.configure**: Protected closure that takes the twig
* **twig.configure**: Protected closure that takes the Twig
environment as an argument. You can use it to add more
custom globals.
* **twig.loader**: The loader for twig templates which uses
* **twig.loader**: The loader for Twig templates which uses
the ``twig.path`` and the ``twig.templates`` options. You
can also replace the loader completely.
......
......@@ -51,7 +51,7 @@ To solve this challenge we came up with a staging area
for routes. The ``ControllerCollection`` holds the
controllers until ``flush`` is called, at which point
the routes are added to the ``RouteCollection``. Also,
the controllers are frozen. This means that they can
the controllers are then frozen. This means that they can
no longer be modified and will throw an Exception if
you try to do so.
......@@ -60,7 +60,7 @@ could be found, which is why flushing is now always
explicit. The Application will flush, but if you want
to read the ``ControllerCollection`` before the
request takes place, you will have to call flush
first.
yourself.
The ``Application`` provides a shortcut ``flush``
method for flushing the ``ControllerCollection``.
......@@ -79,3 +79,6 @@ Following Symfony2 components are used by Silex:
* **Routing**: For matching defined routes.
* **EventDispatcher**: For hooking into the HttpKernel.
For more information, `check out the Symfony website
<http://symfony.com/>`_.
......@@ -97,8 +97,8 @@ Service definitions
Defining services is no different than defining parameters.
You just set an array key on the container to be a closure.
The difference is, when you retrieve the service, the
closure is executed. This allows for lazy service creation.
However, when you retrieve the service, the closure is executed.
This allows for lazy service creation.
::
......@@ -180,15 +180,16 @@ from being executed, by using the ``protect`` method.
Note that protected closures do not get access to
the container.
Predefined services
-------------------
Core services
-------------
Silex defines a range of services which can be used
or replaced. You probably don't want to mess with most
of them.
* **request**: Contains the current request object,
which is an instance of ``Symfony\Component\HttpFoundation\Request``.
which is an instance of `Symfony\Component\HttpFoundation\Request
<http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/Request.html>`_.
It gives you access to ``GET``, ``POST`` parameters
and lots more!
......@@ -197,7 +198,8 @@ of them.
$id = $app['request']->get('id');
* **autoloader**: This service provides you with a
``Symfony\Component\ClassLoader\UniversalClassLoader``
`Symfony\Component\ClassLoader\UniversalClassLoader
<http://api.symfony.com/2.0/Symfony/Component/ClassLoader/UniversalClassLoader.html>`_
that is already registered. You can register prefixes
and namespaces on it.
......@@ -205,7 +207,8 @@ of them.
$app['autoloader']->registerPrefix('Twig_', $app['twig.class_path']);
* **routes**: The ``Symfony\Component\Routing\RouteCollection``
* **routes**: The `Symfony\Component\Routing\RouteCollection
<http://api.symfony.com/2.0/Symfony/Component/Routing/RouteCollection.html>`_
that is used internally. You can add, modify, read
routes.
......@@ -213,15 +216,18 @@ of them.
that is used internally. Check the *Internals*
chapter for more information.
* **dispatcher**: The ``Symfony\Component\EventDispatcher\EventDispatcher``
* **dispatcher**: The `Symfony\Component\EventDispatcher\EventDispatcher
<http://api.symfony.com/2.0/Symfony/Component/EventDispatcher/EventDispatcher.html>`_
that is used internally. It is the core of the Symfony2
system and is used quite a bit by Silex.
* **resolver**: The ``Symfony\Component\HttpKernel\Controller\ControllerResolver``
* **resolver**: The `Symfony\Component\HttpKernel\Controller\ControllerResolver
<http://api.symfony.com/2.0/Symfony/Component/HttpKernel/Controller/ControllerResolver.html>`_
that is used internally. It takes care of executing the
controller with the right arguments.
* **kernel**: The ``Symfony\Component\HttpKernel\HttpKernel``
* **kernel**: The `Symfony\Component\HttpKernel\HttpKernel
<http://api.symfony.com/2.0/Symfony/Component/HttpKernel/HttpKernel.html>`_
that is used internally. The HttpKernel is the heart of
Symfony2, it takes a Request as input and returns a
Response as output.
......
......@@ -209,7 +209,7 @@ can also call ``match``, which will match all methods.
Route variables
~~~~~~~~~~~~~~~
As has been before you can define variable parts in a route like this::
As has been show before you can define variable parts in a route like this::
$app->get('/blog/show/{id}', function($id) {
...
......
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