Skip to content
Browse files

Added uncompressed Silex.

  • Loading branch information...
1 parent 9ae64de commit 7356fdb2ae5de260d3742a31e10e622747859c6c @umpirsky committed
Showing with 9,793 additions and 1 deletion.
  1. +1 −1 src/bootstrap.php
  2. +19 −0 vendor/silex/LICENSE
  3. +38 −0 vendor/silex/README.md
  4. +17 −0 vendor/silex/autoload.php
  5. +9 −0 vendor/silex/compile
  6. +17 −0 vendor/silex/doc/conf.py
  7. +24 −0 vendor/silex/doc/contributing.rst
  8. +172 −0 vendor/silex/doc/extensions.rst
  9. +87 −0 vendor/silex/doc/extensions/doctrine.rst
  10. +74 −0 vendor/silex/doc/extensions/http_cache.rst
  11. +14 −0 vendor/silex/doc/extensions/index.rst
  12. +54 −0 vendor/silex/doc/extensions/monolog.rst
  13. +72 −0 vendor/silex/doc/extensions/session.rst
  14. +132 −0 vendor/silex/doc/extensions/translation.rst
  15. +78 −0 vendor/silex/doc/extensions/twig.rst
  16. +51 −0 vendor/silex/doc/extensions/url_generator.rst
  17. +104 −0 vendor/silex/doc/extensions/validator.rst
  18. +14 −0 vendor/silex/doc/index.rst
  19. +91 −0 vendor/silex/doc/internals.rst
  20. +47 −0 vendor/silex/doc/intro.rst
  21. +264 −0 vendor/silex/doc/services.rst
  22. +185 −0 vendor/silex/doc/testing.rst
  23. +583 −0 vendor/silex/doc/usage.rst
  24. +8 −0 vendor/silex/example.htaccess
  25. +19 −0 vendor/silex/phpunit.xml.dist
  26. +426 −0 vendor/silex/src/Silex/Application.php
  27. +141 −0 vendor/silex/src/Silex/Compiler.php
  28. +154 −0 vendor/silex/src/Silex/Controller.php
  29. +67 −0 vendor/silex/src/Silex/ControllerCollection.php
  30. +21 −0 vendor/silex/src/Silex/Exception/ControllerFrozenException.php
  31. +52 −0 vendor/silex/src/Silex/Extension/DoctrineExtension.php
  32. +49 −0 vendor/silex/src/Silex/Extension/FormExtension.php
  33. +40 −0 vendor/silex/src/Silex/Extension/HttpCacheExtension.php
  34. +64 −0 vendor/silex/src/Silex/Extension/MonologExtension.php
  35. +54 −0 vendor/silex/src/Silex/Extension/SessionExtension.php
  36. +74 −0 vendor/silex/src/Silex/Extension/SwiftmailerExtension.php
  37. +29 −0 vendor/silex/src/Silex/Extension/SymfonyBridgesExtension.php
  38. +52 −0 vendor/silex/src/Silex/Extension/TranslationExtension.php
  39. +62 −0 vendor/silex/src/Silex/Extension/TwigExtension.php
  40. +29 −0 vendor/silex/src/Silex/Extension/UrlGeneratorExtension.php
  41. +45 −0 vendor/silex/src/Silex/Extension/ValidatorExtension.php
  42. +17 −0 vendor/silex/src/Silex/ExtensionInterface.php
  43. +32 −0 vendor/silex/src/Silex/GetResponseForErrorEvent.php
  44. +32 −0 vendor/silex/src/Silex/HttpCache.php
  45. +57 −0 vendor/silex/src/Silex/LazyApplication.php
  46. +33 −0 vendor/silex/src/Silex/RedirectableUrlMatcher.php
  47. +22 −0 vendor/silex/src/Silex/SilexEvents.php
  48. +38 −0 vendor/silex/src/Silex/StringResponseConverter.php
  49. +56 −0 vendor/silex/src/Silex/WebTestCase.php
  50. +127 −0 vendor/silex/tests/Silex/Tests/ApplicationTest.php
  51. +183 −0 vendor/silex/tests/Silex/Tests/BeforeAfterFilterTest.php
  52. +88 −0 vendor/silex/tests/Silex/Tests/ControllerCollectionTest.php
  53. +91 −0 vendor/silex/tests/Silex/Tests/ControllerTest.php
  54. +161 −0 vendor/silex/tests/Silex/Tests/ErrorHandlerTest.php
  55. +71 −0 vendor/silex/tests/Silex/Tests/Extension/MonologExtensionTest.php
  56. +58 −0 vendor/silex/tests/Silex/Tests/Extension/SessionExtensionTest.php
  57. +50 −0 vendor/silex/tests/Silex/Tests/Extension/TwigExtensionTest.php
  58. +120 −0 vendor/silex/tests/Silex/Tests/Extension/UrlGeneratorExtensionTest.php
  59. +129 −0 vendor/silex/tests/Silex/Tests/FunctionalTest.php
  60. +213 −0 vendor/silex/tests/Silex/Tests/RouterTest.php
  61. +56 −0 vendor/silex/tests/Silex/Tests/WebTestCaseTest.php
  62. +16 −0 vendor/silex/tests/bootstrap.php
  63. +10 −0 vendor/silex/vendor/monolog/CHANGELOG.mdown
  64. +19 −0 vendor/silex/vendor/monolog/LICENSE
  65. +93 −0 vendor/silex/vendor/monolog/README.mdown
  66. +18 −0 vendor/silex/vendor/monolog/composer.json
  67. +15 −0 vendor/silex/vendor/monolog/phpunit.xml.dist
  68. +36 −0 vendor/silex/vendor/monolog/src/Monolog/Formatter/FormatterInterface.php
  69. +40 −0 vendor/silex/vendor/monolog/src/Monolog/Formatter/JsonFormatter.php
  70. +105 −0 vendor/silex/vendor/monolog/src/Monolog/Formatter/LineFormatter.php
  71. +83 −0 vendor/silex/vendor/monolog/src/Monolog/Formatter/WildfireFormatter.php
  72. +169 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/AbstractHandler.php
  73. +70 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/AbstractProcessingHandler.php
  74. +67 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/BufferHandler.php
  75. +95 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/FingersCrossedHandler.php
  76. +145 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/FirePHPHandler.php
  77. +74 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/GroupHandler.php
  78. +77 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/HandlerInterface.php
  79. +54 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/MailHandler.php
  80. +49 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/NativeMailerHandler.php
  81. +37 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/NullHandler.php
  82. +109 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/RotatingFileHandler.php
  83. +72 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/StreamHandler.php
  84. +55 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/SwiftMailerHandler.php
  85. +109 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/SyslogHandler.php
  86. +120 −0 vendor/silex/vendor/monolog/src/Monolog/Handler/TestHandler.php
  87. +380 −0 vendor/silex/vendor/monolog/src/Monolog/Logger.php
  88. +58 −0 vendor/silex/vendor/monolog/src/Monolog/Processor/IntrospectionProcessor.php
  89. +60 −0 vendor/silex/vendor/monolog/src/Monolog/Processor/WebProcessor.php
  90. +35 −0 vendor/silex/vendor/monolog/tests/Monolog/Formatter/JsonFormatterTest.php
  91. +113 −0 vendor/silex/vendor/monolog/tests/Monolog/Formatter/LineFormatterTest.php
  92. +38 −0 vendor/silex/vendor/monolog/tests/Monolog/Formatter/WildfireFormatterTest.php
  93. +30 −0 vendor/silex/vendor/monolog/tests/Monolog/Functional/Handler/FirePHPHandlerTest.php
  94. +93 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/AbstractHandlerTest.php
  95. +72 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/AbstractProcessingHandlerTest.php
  96. +84 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/BufferHandlerTest.php
  97. +136 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/FingersCrossedHandlerTest.php
  98. +91 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/FirePHPHandlerTest.php
  99. 0 vendor/silex/vendor/monolog/tests/Monolog/Handler/Fixtures/.gitkeep
  100. +71 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/GroupHandlerTest.php
  101. +69 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/MailHandlerTest.php
  102. +33 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/NullHandlerTest.php
  103. +100 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/RotatingFileHandlerTest.php
  104. +77 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/StreamHandlerTest.php
  105. +41 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/SyslogHandlerTest.php
  106. +54 −0 vendor/silex/vendor/monolog/tests/Monolog/Handler/TestHandlerTest.php
  107. +166 −0 vendor/silex/vendor/monolog/tests/Monolog/LoggerTest.php
  108. +64 −0 vendor/silex/vendor/monolog/tests/Monolog/Processor/IntrospectionProcessorTest.php
  109. +39 −0 vendor/silex/vendor/monolog/tests/Monolog/Processor/WebProcessorTest.php
  110. +58 −0 vendor/silex/vendor/monolog/tests/Monolog/TestCase.php
  111. +21 −0 vendor/silex/vendor/monolog/tests/bootstrap.php
  112. +19 −0 vendor/silex/vendor/pimple/LICENSE
  113. +109 −0 vendor/silex/vendor/pimple/README.rst
  114. +130 −0 vendor/silex/vendor/pimple/lib/Pimple.php
  115. +19 −0 vendor/silex/vendor/pimple/phpunit.xml.dist
  116. +144 −0 vendor/silex/vendor/pimple/tests/Pimple/Tests/PimpleTest.php
  117. +39 −0 vendor/silex/vendor/pimple/tests/Pimple/Tests/Service.php
  118. +13 −0 vendor/silex/vendor/pimple/tests/bootstrap.php
  119. +9 −0 vendor/silex/vendor/twig/AUTHORS
  120. +343 −0 vendor/silex/vendor/twig/CHANGELOG
  121. +31 −0 vendor/silex/vendor/twig/LICENSE
  122. +8 −0 vendor/silex/vendor/twig/README.markdown
  123. +42 −0 vendor/silex/vendor/twig/bin/create_pear_package.php
Sorry, we could not display the entire diff because too many files (402) changed.
View
2 src/bootstrap.php
@@ -6,7 +6,7 @@
* (c) Saša Stamenković <umpirsky@gmail.com>
*/
-include __DIR__ . '/../vendor/silex.phar';
+include __DIR__ . '/../vendor/silex/autoload.php';
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
View
19 vendor/silex/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2010 Fabien Potencier
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
38 vendor/silex/README.md
@@ -0,0 +1,38 @@
+Silex, a simple Web Framework
+=============================
+
+Silex is a simple web framework to develop simple websites based on
+[Symfony2][1] components:
+
+
+```php
+<?php
+require_once __DIR__.'/silex.phar';
+
+$app = new Silex\Application();
+
+$app->get('/hello/{name}', function ($name) use ($app) {
+ return 'Hello '.$app->escape($name);
+});
+
+$app->run();
+```
+
+Silex works with PHP 5.3.2 or later.
+
+## Installation
+
+Installing Silex is as easy as it can get. Download the [`silex.phar`][2] file
+and you're done!
+
+## More Information
+
+Read the [documentation][3] for more information.
+
+## License
+
+Silex is licensed under the MIT license.
+
+[1]: http://symfony.com
+[2]: http://silex-project.org/get/silex.phar
+[3]: http://silex-project.org/documentation
View
17 vendor/silex/autoload.php
@@ -0,0 +1,17 @@
+<?php
+
+if (false === class_exists('Symfony\Component\ClassLoader\UniversalClassLoader', false)) {
+ require_once __DIR__.'/../../vendor/symfony/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
+}
+
+use Symfony\Component\ClassLoader\UniversalClassLoader;
+
+$loader = new UniversalClassLoader();
+$loader->registerNamespaces(array(
+ 'Symfony' => __DIR__.'/../../vendor/symfony/src',
+ 'Silex' => __DIR__.'/src',
+));
+$loader->registerPrefixes(array(
+ 'Pimple' => __DIR__.'/vendor/pimple/lib',
+));
+$loader->register();
View
9 vendor/silex/compile
@@ -0,0 +1,9 @@
+#!/usr/bin/env php
+<?php
+
+require_once __DIR__.'/autoload.php';
+
+use Silex\Compiler;
+
+$compiler = new Compiler();
+$compiler->compile();
View
17 vendor/silex/doc/conf.py
@@ -0,0 +1,17 @@
+import sys, os
+from sphinx.highlighting import lexers
+from pygments.lexers.web import PhpLexer
+
+sys.path.append(os.path.abspath('_exts'))
+
+extensions = []
+master_doc = 'index'
+highlight_language = 'php'
+
+project = u'Silex'
+copyright = u'2010 Fabien Potencier'
+
+version = '0'
+release = '0.0.0'
+
+lexers['php'] = PhpLexer(startinline=True)
View
24 vendor/silex/doc/contributing.rst
@@ -0,0 +1,24 @@
+Contributing
+============
+
+We are open to contributions to the Silex code. If you find
+a bug or want to contribute an extension, just follow these
+steps.
+
+* Fork `the Silex repository <https://github.com/fabpot/Silex>`_
+ on github.
+
+* Make your feature addition or bug fix.
+
+* Add tests for it. This is important so we don't break it in a future version unintentionally.
+
+* 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
+ License.
View
172 vendor/silex/doc/extensions.rst
@@ -0,0 +1,172 @@
+Extensions
+==========
+
+Silex provides a common interface for extensions. These
+define services on the application.
+
+Loading extensions
+------------------
+
+In order to load and use an extension, you must register it
+on the application. ::
+
+ $app = new Silex\Application();
+
+ $app->register(new Acme\DatabaseExtension());
+
+You can also provide some parameters as a second argument. These
+will be set **before** the extension is registered.
+
+::
+
+ $app->register(new Acme\DatabaseExtension(), array(
+ 'database.dsn' => 'mysql:host=localhost;dbname=myapp',
+ 'database.user' => 'root',
+ 'database.password' => 'secret_root_password',
+ ));
+
+Conventions
+-----------
+
+You need to watch out in what order you do certain things when
+interacting with extensions. Just keep to these rules:
+
+* Class paths (for the autoloader) must be defined **before**
+ the extension is registered. Passing it as a second argument
+ to ``Application::register`` qualifies too, because it sets
+ the passed parameters first.
+
+ *Reason: The extension will set up the autoloader at
+ extension register time. If the class path is not set
+ at that point, no autoloader can be registered.*
+
+* Overriding existing services must occur **after** the
+ extension is registered.
+
+ *Reason: If the services already exist, the extension
+ will overwrite it.*
+
+* You can set parameters any time before the service is
+ accessed.
+
+Make sure to stick to this behavior when creating your
+own extensions.
+
+Included extensions
+-------------------
+
+There are a few extensions that you get out of the box.
+All of these are within the ``Silex\Extension`` namespace.
+
+* :doc:`DoctrineExtension <extensions/doctrine>`
+* :doc:`MonologExtension <extensions/monolog>`
+* :doc:`SessionExtension <extensions/session>`
+* :doc:`TwigExtension <extensions/twig>`
+* :doc:`TranslationExtension <extensions/translation>`
+* :doc:`UrlGeneratorExtension <extensions/url_generator>`
+* :doc:`ValidatorExtension <extensions/validator>`
+* :doc:`HttpCacheExtension <extensions/http_cache>`
+
+Creating an extension
+---------------------
+
+Extensions must implement the ``Silex\ExtensionInterface``.
+
+::
+
+ interface ExtensionInterface
+ {
+ function register(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.
+
+Here is an example of such an extension::
+
+ namespace Acme;
+
+ use Silex\Application;
+ use Silex\ExtensionInterface;
+
+ class HelloExtension implements ExtensionInterface
+ {
+ public function register(Application $app)
+ {
+ $app['hello'] = $app->protect(function ($name) use ($app) {
+ $default = $app['hello.default_name'] ? $app['hello.default_name'] : '';
+ $name = $name ?: $default;
+
+ return 'Hello '.$app->escape($name);
+ });
+ }
+ }
+
+This class provides a ``hello`` service which is a protected
+closure. It takes a name argument and will return
+``hello.default_name`` if no name is given. If the default
+is also missing, it will use an empty string.
+
+You can now use this extension as follows::
+
+ $app = new Silex\Application();
+
+ $app->register(new Acme\HelloExtension(), array(
+ 'hello.default_name' => 'Igor',
+ ));
+
+ $app->get('/hello', function () use ($app) {
+ $name = $app['request']->get('name');
+
+ return $app['hello']($name);
+ });
+
+In this example we are getting the ``name`` parameter from the
+query string, so the request path would have to be ``/hello?name=Fabien``.
+
+Class loading
+~~~~~~~~~~~~~
+
+Extensions are great for tying in external libraries as you
+can see by looking at the ``MonologExtension`` and
+``TwigExtension``. If the library is decent and follows the
+`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
+classes using the ``UniversalClassLoader``.
+
+As described in the *Services* chapter, there is an
+*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>`_)::
+
+ namespace Acme;
+
+ use Silex\Application;
+ use Silex\ExtensionInterface;
+
+ class BuzzExtension implements ExtensionInterface
+ {
+ public function register(Application $app)
+ {
+ $app['buzz'] = $app->share(function () { ... });
+
+ if (isset($app['buzz.class_path'])) {
+ $app['autoloader']->registerNamespace('Buzz', $app['buzz.class_path']);
+ }
+ }
+ }
+
+This allows you to simply provide the class path as an
+option when registering the extension::
+
+ $app->register(new BuzzExtension(), array(
+ 'buzz.class_path' => __DIR__.'/vendor/buzz/lib',
+ ));
+
+.. note::
+
+ For libraries that do not use PHP 5.3 namespaces you can use ``registerPrefix``
+ instead of ``registerNamespace``, which will use an underscore as directory
+ delimiter.
View
87 vendor/silex/doc/extensions/doctrine.rst
@@ -0,0 +1,87 @@
+DoctrineExtension
+=================
+
+The *DoctrineExtension* provides integration with the `Doctrine DBAL
+<http://www.doctrine-project.org/projects/dbal>`_ for easy database acccess.
+
+.. note::
+
+ There is only a Doctrine DBAL. An ORM service is **not** supplied.
+
+Parameters
+----------
+
+* **db.options**: Array of Doctrine DBAL options.
+
+ These options are available:
+
+ * **driver**: The database driver to use, defaults to ``pdo_mysql``.
+ Can be any of: ``pdo_mysql``, ``pdo_sqlite``, ``pdo_pgsql``,
+ ``pdo_oci``, ``oci8``, ``ibm_db2``, ``pdo_ibm``, ``pdo_sqlsrv``.
+
+ * **dbname**: The name of the database to connect to.
+
+ * **host**: The host of the database to connect to. Defaults to
+ localhost.
+
+ * **user**: The user of the database to connect to. Defaults to
+ root.
+
+ * **password**: The password of the database to connect to.
+
+ * **path**: Only relevant for ``pdo_sqlite``, specifies the path to
+ the SQLite database.
+
+ These and additional options are described in detail in the `Doctrine DBAL
+ configuration documentation <http://www.doctrine-project.org/docs/dbal/2.0/en/reference/configuration.html>`_.
+
+* **db.dbal.class_path** (optional): Path to where the
+ Doctrine DBAL is located.
+
+* **db.common.class_path** (optional): Path to where
+ Doctrine Common is located.
+
+Services
+--------
+
+* **db**: The database connection, instance of
+ ``Doctrine\DBAL\Connection``.
+
+* **db.config**: Configuration object for Doctrine. Defaults to
+ an empty ``Doctrine\DBAL\Configuration``.
+
+* **db.event_manager**: Event Manager for Doctrine.
+
+Registering
+-----------
+
+Make sure you place a copy of *Doctrine DBAL* in ``vendor/doctrine-dbal``
+and *Doctrine Common* in ``vendor/doctrine-common``.
+
+::
+
+ $app->register(new Silex\Extension\DoctrineExtension(), array(
+ 'db.options' => array(
+ 'driver' => 'pdo_sqlite',
+ 'path' => __DIR__.'/app.db',
+ ),
+ 'db.dbal.class_path' => __DIR__.'/vendor/doctrine-dbal/lib',
+ 'db.common.class_path' => __DIR__.'/vendor/doctrine-common/lib',
+ ));
+
+Usage
+-----
+
+The Doctrine extension provides a ``db`` service. Here is a usage
+example::
+
+ $app->get('/blog/show/{id}', function ($id) use ($app) {
+ $sql = "SELECT * FROM posts WHERE id = ?";
+ $post = $app['db']->fetchAssoc($sql, array((int) $id));
+
+ return "<h1>{$post['title']}</h1>".
+ "<p>{$post['body']}</p>";
+ });
+
+For more information, consult the `Doctrine DBAL documentation
+<http://www.doctrine-project.org/docs/dbal/2.0/en/>`_.
View
74 vendor/silex/doc/extensions/http_cache.rst
@@ -0,0 +1,74 @@
+HttpCacheExtension
+==================
+
+The *HttpCacheExtension* provides support for the Symfony2 Reverse Proxy.
+
+Parameters
+----------
+
+* **http_cache.cache_dir**: The cache directory to store the HTTP cache data.
+
+* **http_cache.options** (optional): An array of options for the `HttpCache
+ <http://api.symfony.com/2.0/Symfony/Component/HttpKernel/HttpCache/HttpCache.html>`_
+ constructor.
+
+Services
+--------
+
+* **http_cache**: An instance of `HttpCache
+ <http://api.symfony.com/2.0/Symfony/Component/HttpKernel/HttpCache/HttpCache.html>`_,
+
+Registering
+-----------
+
+::
+
+ $app->register(new Silex\Extension\HttpCacheExtension(), array(
+ 'http_cache.cache_dir' => __DIR__.'/cache/',
+ ));
+
+Usage
+-----
+
+Silex already supports any Reverse Proxy like Varnish out of the box by
+setting Response HTTP cache headers::
+
+ $app->get('/', function() {
+ return new Response('Foo', 200, array(
+ 'Cache-Control' => 's-maxage=5',
+ ));
+ });
+
+This extension allows you to use the Symfony2 reverse proxy natively with
+Silex applications by using the `http_cache` service::
+
+ $app['http_cache']->run();
+
+The extension also provide ESI support::
+
+ $app->get('/', function() {
+ return new Response(<<<EOF
+ <html>
+ <body>
+ Hello
+ <esi:include src="/included" />
+ </body>
+ </html>
+
+ EOF
+ , 200, array(
+ 'Cache-Control' => 's-maxage=20',
+ 'Surrogate-Control' => 'content="ESI/1.0"',
+ ));
+ });
+
+ $app->get('/included', function() {
+ return new Response('Foo', 200, array(
+ 'Cache-Control' => 's-maxage=5',
+ ));
+ });
+
+ $app['http_cache']->run();
+
+For more information, consult the `Symfony2 HTTP Cache documentation
+<http://symfony.com/doc/current/book/http_cache.html>`_.
View
14 vendor/silex/doc/extensions/index.rst
@@ -0,0 +1,14 @@
+Silex
+=====
+
+.. toctree::
+ :maxdepth: 1
+
+ doctrine
+ monolog
+ session
+ translation
+ twig
+ url_generator
+ validator
+ http_cache
View
54 vendor/silex/doc/extensions/monolog.rst
@@ -0,0 +1,54 @@
+MonologExtension
+================
+
+The *MonologExtension* provides a default logging mechanism
+through Jordi Boggiano's `Monolog <https://github.com/Seldaek/monolog>`_
+library.
+
+It will log requests and errors and allow you to add debug
+logging to your application, so you don't have to use
+``var_dump`` so much anymore. You can use the grown-up
+version called ``tail -f``.
+
+Parameters
+----------
+
+* **monolog.logfile**: File where logs are written to.
+
+* **monolog.class_path** (optional): Path to where the
+ Monolog library is located.
+
+* **monolog.level** (optional): Level of logging defaults
+ to ``DEBUG``. Must be one of ``Logger::DEBUG``, ``Logger::INFO``,
+ ``Logger::WARNING``, ``Logger::ERROR``. ``DEBUG`` will log
+ everything, ``INFO`` will log everything except ``DEBUG``,
+ etc.
+
+* **monolog.name** (optional): Name of the monolog channel,
+ defaults to ``myapp``.
+
+Services
+--------
+
+* **monolog**: The monolog logger instance.
+
+ Example usage::
+
+ $app['monolog']->addDebug('Testing the Monolog logging.');
+
+* **monolog.configure**: Protected closure that takes the
+ logger as an argument. You can override it if you do not
+ want the default behavior.
+
+Registering
+-----------
+
+Make sure you place a copy of *Monolog* in the ``vendor/monolog``
+directory.
+
+::
+
+ $app->register(new Silex\Extension\MonologExtension(), array(
+ 'monolog.logfile' => __DIR__.'/development.log',
+ 'monolog.class_path' => __DIR__.'/vendor/monolog/src',
+ ));
View
72 vendor/silex/doc/extensions/session.rst
@@ -0,0 +1,72 @@
+SessionExtension
+================
+
+The *SessionExtension* provides a service for storing data persistently
+between requests.
+
+Parameters
+----------
+
+* **session.storage.options**: An array of options that is passed to the
+ constructor of the ``session.storage`` service.
+
+ In case of the default ``NativeSessionStorage``, the possible options are:
+
+ * **name**: The cookie name (_SESS by default)
+ * **id**: The session id (null by default)
+ * **lifetime**: Cookie lifetime
+ * **path**: Cookie path
+ * **domain**: Cookie domain
+ * **secure**: Cookie secure (HTTPS)
+ * **httponly**: Whether the cookie is http only
+
+ However, all of these are optional. Sessions last as long as the browser
+ is open. To override this, set the ``lifetime`` option.
+
+Services
+--------
+
+* **session**: An instance of Symfony2's `Session
+ <http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/Session.html>`_.
+
+* **session.storage**: A service that is used for persistence of the
+ session data. Defaults to a `NativeSessionStorage
+ <http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.html>`_.
+
+Registering
+-----------
+
+::
+
+ $app->register(new Silex\Extension\SessionExtension());
+
+Usage
+-----
+
+The Session extension provides a ``session`` service. Here is an
+example that authenticates a user and creates a session for him::
+
+ use Symfony\Component\HttpFoundation\Response;
+
+ $app->get('/login', function () use ($app) {
+ $username = $app['request']->server->get('PHP_AUTH_USER', false);
+ $password = $app['request']->server->get('PHP_AUTH_PW');
+
+ if ('igor' === $username && 'password' === $password) {
+ $app['session']->set('user', array('username' => $username));
+ return $app->redirect('/account');
+ }
+
+ $response = new Response();
+ $response->headers->set('WWW-Authenticate', sprintf('Basic realm="%s"', 'site_login'));
+ $response->setStatusCode(401, 'Please sign in.');
+ return $response;
+ });
+
+ $app->get('/account', function () use ($app) {
+ if (null === $user = $app['session']->get('user')) {
+ return $app->redirect('/login');
+ }
+
+ return "Welcome {$user['username']}!";
+ });
View
132 vendor/silex/doc/extensions/translation.rst
@@ -0,0 +1,132 @@
+TranslationExtension
+=====================
+
+The *TranslationExtension* provides a service for translating your application
+into different languages.
+
+Parameters
+----------
+
+* **translator.messages**: A mapping of locales to message arrays. This parameter
+ contains the translation data in all languages.
+
+* **locale** (optional): The locale for the translator. You will most likely want
+ to set this based on some request parameter. Defaults to ``en``.
+
+* **locale_fallback** (optional): Fallback locale for the translator. It will
+ be used when the current locale has no messages set.
+
+* **translation.class_path** (optional): Path to where
+ the Symfony2 Translation component is located.
+
+Services
+--------
+
+* **translator**: An instance of `Translator
+ <http://api.symfony.com/2.0/Symfony/Component/Translation/Translator.html>`_,
+ that is used for translation.
+
+* **translator.loader**: An instance of an implementation of the translation
+ `LoaderInterface <http://api.symfony.com/2.0/Symfony/Component/Translation/Loader/LoaderInterface.html>`_,
+ defaults to an `ArrayLoader
+ <http://api.symfony.com/2.0/Symfony/Component/Translation/Loader/ArrayLoader.html>`_.
+
+* **translator.message_selector**: An instance of `MessageSelector
+ <http://api.symfony.com/2.0/Symfony/Component/Translation/MessageSelector.html>`_.
+
+Registering
+-----------
+
+Make sure you place a copy of the Symfony2 Translation component in
+``vendor/symfony/src``. You can simply clone the whole Symfony2 into vendor.
+
+::
+
+ $app->register(new Silex\Extension\TranslationExtension(), array(
+ 'locale_fallback' => 'en',
+ 'translation.class_path' => __DIR__.'/vendor/symfony/src',
+ ));
+
+Usage
+-----
+
+The Translation extension provides a ``translator`` service and makes use of
+the ``translator.messages`` parameter.
+
+::
+
+ $app['translator.messages'] = array(
+ 'en' => array(
+ 'hello' => 'Hello %name%',
+ 'goodbye' => 'Goodbye %name%',
+ ),
+ 'de' => array(
+ 'hello' => 'Hallo %name%',
+ 'goodbye' => 'Tschüss %name%',
+ ),
+ 'fr' => array(
+ 'hello' => 'Bonjour %name%',
+ 'goodbye' => 'Au revoir %name%',
+ ),
+ );
+
+ $app->before(function () use ($app) {
+ if ($locale = $app['request']->get('locale')) {
+ $app['locale'] = $locale;
+ }
+ });
+
+ $app->get('/{locale}/{message}/{name}', function ($message, $name) use ($app) {
+ return $app['translator']->trans($message, array('%name%' => $name));
+ });
+
+The above example will result in following routes:
+
+* ``/en/hello/igor`` will return ``Hello igor``.
+
+* ``/de/hello/igor`` will return ``Hallo igor``.
+
+* ``/fr/hello/igor`` will return ``Bonjour igor``.
+
+* ``/it/hello/igor`` will return ``Hello igor`` (because of the fallback).
+
+Recipes
+-------
+
+YAML-based language files
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Having your translation in PHP files can be inconvenient. This recipe will
+show you how to load translations from external YAML files.
+
+First you will need the ``Config`` and ``Yaml`` components from Symfony2. Also
+make sure you register them with the autoloader. You can just clone the entire
+Symfony2 repository into ``vendor/symfony``.
+
+::
+
+ $app['autoloader']->registerNamespace('Symfony', __DIR__.'/vendor/symfony/src');
+
+Next, you have to create the language mappings in YAML files. A naming you can
+use is ``locales/en.yml``. Just do the mapping in this file as follows:
+
+.. code-block:: yaml
+
+ hello: Hello %name%
+ goodbye: Goodbye %name%
+
+Repeat this for all of your languages. Then set up the ``translator.messages`` to map
+languages to files::
+
+ $app['translator.messages'] = array(
+ 'en' => __DIR__.'/locales/en.yml',
+ 'de' => __DIR__.'/locales/de.yml',
+ 'fr' => __DIR__.'/locales/fr.yml',
+ );
+
+Finally override the ``translator.loader`` to use a ``YamlFileLoader`` instead of the
+default ``ArrayLoader``::
+
+ $app['translator.loader'] = new Symfony\Component\Translation\Loader\YamlFileLoader();
+
+And that's all you need to load translations from YAML files.
View
78 vendor/silex/doc/extensions/twig.rst
@@ -0,0 +1,78 @@
+TwigExtension
+=============
+
+The *TwigExtension* provides integration with the `Twig
+<http://www.twig-project.org/>`_ template engine.
+
+Parameters
+----------
+
+* **twig.path**: Path to the directory containing twig template
+ files.
+
+* **twig.templates** (optional): If this option is provided
+ you don't have to provide a ``twig.path``. It is an
+ associative array of template names to template contents.
+ Use this if you want to define your templates inline.
+
+* **twig.options** (optional): An associative array of twig
+ options. Check out the twig documentation for more information.
+
+* **twig.class_path** (optional): Path to where the Twig
+ library is located.
+
+Services
+--------
+
+* **twig**: The ``Twig_Environment`` instance. The main way of
+ interacting with 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
+ the ``twig.path`` and the ``twig.templates`` options. You
+ can also replace the loader completely.
+
+Registering
+-----------
+
+Make sure you place a copy of *Twig* in the ``vendor/twig``
+directory.
+
+::
+
+ $app->register(new Silex\Extension\TwigExtension(), array(
+ 'twig.path' => __DIR__.'/views',
+ 'twig.class_path' => __DIR__.'/vendor/twig/lib',
+ ));
+
+.. note::
+
+ Twig is not compiled into the ``silex.phar`` file. You have to
+ add your own copy of Twig to your application.
+
+Usage
+-----
+
+The Twig extension provides a ``twig`` service.
+
+::
+
+ $app->get('/hello/{name}', function ($name) use ($app) {
+ return $app['twig']->render('hello.twig', array(
+ 'name' => $name,
+ ));
+ });
+
+This will render a file named ``views/hello.twig``.
+
+It also registers the application as a global named
+``app``. So you can access any services from within your
+view. For example to access ``$app['request']->getHost()``,
+just put this in your template:
+
+.. code-block:: jinja
+
+ {{ app.request.host }}
View
51 vendor/silex/doc/extensions/url_generator.rst
@@ -0,0 +1,51 @@
+UrlGeneratorExtension
+=====================
+
+The *UrlGeneratorExtension* provides a service for generating
+URLs for named routes.
+
+Parameters
+----------
+
+None.
+
+Services
+--------
+
+* **url_generator**: An instance of `UrlGenerator
+ <http://api.symfony.com/2.0/Symfony/Component/Routing/Generator/UrlGenerator.html>`_,
+ using the `RouteCollection
+ <http://api.symfony.com/2.0/Symfony/Component/Routing/RouteCollection.html>`_
+ that is provided through the ``routes`` service.
+ It has a ``generate`` method, which takes the route name as an argument,
+ followed by an array of route parameters.
+
+Registering
+-----------
+
+::
+
+ $app->register(new Silex\Extension\UrlGeneratorExtension());
+
+Usage
+-----
+
+The UrlGenerator extension provides a ``url_generator`` service.
+
+::
+
+ $app->get('/', function () {
+ return 'welcome to the homepage';
+ })
+ ->bind('homepage');
+
+ $app->get('/hello/{name}', function ($name) {
+ return "Hello $name!";
+ })
+ ->bind('hello');
+
+ $app->get('/navigation', function () use ($app) {
+ return '<a href="'.$app['url_generator']->generate('homepage').'">Home</a>'.
+ ' | '.
+ '<a href="'.$app['url_generator']->generate('hello', array('name' => 'Igor')).'">Hello Igor</a>';
+ });
View
104 vendor/silex/doc/extensions/validator.rst
@@ -0,0 +1,104 @@
+ValidatorExtension
+=====================
+
+The *ValidatorExtension* provides a service for validating data. It is
+most useful when used with the *FormExtension*, but can also be used
+standalone.
+
+Parameters
+----------
+
+* **validator.class_path** (optional): Path to where
+ the Symfony2 Validator component is located.
+
+Services
+--------
+
+* **validator**: An instance of `Validator
+ <http://api.symfony.com/2.0/Symfony/Component/Validator/Validator.html>`_.
+
+* **validator.mapping.class_metadata_factory**: Factory for metadata loaders,
+ which can read validation constraint information from classes. Defaults to
+ StaticMethodLoader--ClassMetadataFactory.
+
+ This means you can define a static ``loadValidatorMetadata`` method on your
+ data class, which takes a ClassMetadata argument. Then you can set
+ constraints on this ClassMetadata instance.
+
+* **validator.validator_factory**: Factory for ConstraintValidators. Defaults
+ to a standard ``ConstraintValidatorFactory``. Mostly used internally by the
+ Validator.
+
+Registering
+-----------
+
+Make sure you place a copy of the Symfony2 Validator component in
+``vendor/symfony/src``. You can simply clone the whole Symfony2 into vendor.
+
+::
+
+ $app->register(new Silex\Extension\ValidatorExtension(), array(
+ 'validator.class_path' => __DIR__.'/vendor/symfony/src',
+ ));
+
+Usage
+-----
+
+The Validator extension provides a ``validator`` service.
+
+Validating values
+~~~~~~~~~~~~~~~~~
+
+You can validate values directly using the ``validateValue`` validator method.
+
+::
+
+ use Symfony\Component\Validator\Constraints;
+
+ $app->get('/validate-url', function () use ($app) {
+ $violations = $app['validator']->validateValue($app['request']->get('url'), new Constraints\Url());
+ return $violations;
+ });
+
+This is relatively limited.
+
+Validating object properties
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you want to add validations to a class, you can implement a static
+``loadValidatorMetadata`` method as described under *Services*. This allows
+you to define constraints for your object properties. It also works with
+getters.
+
+::
+
+ use Symfony\Component\Validator\Mapping\ClassMetadata;
+ use Symfony\Component\Validator\Constraints;
+
+ class Post
+ {
+ public $title;
+ public $body;
+
+ static public function loadValidatorMetadata(ClassMetadata $metadata)
+ {
+ $metadata->addPropertyConstraint('title', new Constraints\NotNull());
+ $metadata->addPropertyConstraint('title', new Constraints\NotBlank());
+ $metadata->addPropertyConstraint('body', new Constraints\MinLength(array('limit' => 10)));
+ }
+ }
+
+ $app->post('/posts/new', function () use ($app) {
+ $post = new Post();
+ $post->title = $app['request']->get('title');
+ $post->body = $app['request']->get('body');
+
+ $violations = $app['validator']->validate($post);
+ return $violations;
+ });
+
+You will have to handle the display of these violations yourself. You can
+however use the *FormExtension* which can make use of the *ValidatorExtension*.
+
+For more information, consult the `Symfony2 Validation documentation
+<http://symfony.com/doc/2.0/book/validation.html>`_.
View
14 vendor/silex/doc/index.rst
@@ -0,0 +1,14 @@
+Silex
+=====
+
+.. toctree::
+ :maxdepth: 1
+
+ intro
+ usage
+ services
+ extensions
+ testing
+ internals
+ contributing
+ extensions/index
View
91 vendor/silex/doc/internals.rst
@@ -0,0 +1,91 @@
+Internals
+=========
+
+This chapter will tell you a bit about how Silex works
+internally.
+
+Silex
+-----
+
+Application
+~~~~~~~~~~~
+
+The application is the main interface to Silex. It
+implements Symfony2's `HttpKernelInterface
+<http://api.symfony.com/2.0/Symfony/Component/HttpKernel/HttpKernelInterface.html>`_,
+so you can pass a `Request
+<http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/Request.html>`_
+to the ``handle`` method and it will return a `Response
+<http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/Response.html>`_.
+
+It extends the ``Pimple`` service container, allowing
+for flexibility on the outside as well as the inside. you
+could replace any service, and you are also able to read
+them.
+
+The application makes strong use of the `EventDispatcher
+<http://api.symfony.com/2.0/Symfony/Component/EventDispatcher/EventDispatcher.html>`_
+to hook into the Symfony2 HttpKernel events. This allows
+fetching the ``Request``, converting string responses into
+``Response`` objects and handling Exceptions. We also use it
+to dispatch some custom events like before/after filters and
+errors.
+
+Controller
+~~~~~~~~~~
+
+The Symfony2 `Route
+<http://api.symfony.com/2.0/Symfony/Component/Routing/Route.html>`_
+is actually quite powerful. Routes
+can be named, which allows for URL generation. They can
+also have requirements for the variable parts. In order
+to allow settings these through a nice interface the
+``match`` method (which is used by ``get``, ``post``, etc.)
+returns an instance of the ``Controller``, which wraps
+a route.
+
+ControllerCollection
+~~~~~~~~~~~~~~~~~~~~
+
+One of the goals of exposing the `RouteCollection
+<http://api.symfony.com/2.0/Symfony/Component/Routing/RouteCollection.html>`_
+was to make it mutable, so extensions could add stuff to it.
+The challenge here is the fact that routes know nothing
+about their name. The name only has meaning in context
+of the ``RouteCollection`` and cannot be changed.
+
+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 then frozen. This means that they can
+no longer be modified and will throw an Exception if
+you try to do so.
+
+Unfortunately no good way for flushing implicitly
+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
+yourself.
+
+The ``Application`` provides a shortcut ``flush``
+method for flushing the ``ControllerCollection``.
+
+Symfony2
+--------
+
+Following Symfony2 components are used by Silex:
+
+* **ClassLoader**: For autoloading classes.
+
+* **HttpFoundation**: For ``Request`` and ``Response``.
+
+* **HttpKernel**: Because we need a heart.
+
+* **Routing**: For matching defined routes.
+
+* **EventDispatcher**: For hooking into the HttpKernel.
+
+For more information, `check out the Symfony website
+<http://symfony.com/>`_.
View
47 vendor/silex/doc/intro.rst
@@ -0,0 +1,47 @@
+Introduction
+============
+
+Silex is a PHP microframework for PHP 5.3. It is built on the shoulders
+of Symfony2 and Pimple and also inspired by sinatra.
+
+A microframework provides the guts for building simple single-file apps.
+Silex aims to be:
+
+* *Concise*: Silex exposes a intuitive and concise API that is fun to use.
+
+* *Extensible*: Silex has an extension system based around the Pimple
+ micro service-container that makes it even easier to tie in third party
+ libraries.
+
+* *Testable*: Silex uses Symfony2's HttpKernel which abstracts request and
+ response. This makes it very easy to test apps and the framework itself.
+ It also respects the HTTP specification and encourages its proper use.
+
+In a nutshell, you define controllers and map them to routes, all in one
+step.
+
+**Let's go!** ::
+
+ require_once __DIR__.'/silex.phar';
+
+ $app = new Silex\Application();
+
+ $app->get('/hello/{name}', function ($name) use ($app) {
+ return 'Hello '.$app->escape($name);
+ });
+
+ $app->run();
+
+All that is needed to get access to the Framework is to include
+``silex.phar``. This phar (PHP Archive) file will take care of the rest.
+
+Next we define a route to ``/hello/{name}`` that matches for ``GET``
+requests. When the route matches, the function is executed and the return
+value is sent back to the client.
+
+Finally, the app is run. It's really that easy!
+
+Installing Silex is as easy as it can get. Download the `silex.phar`_ file
+and you're done!
+
+.. _silex.phar: http://silex-project.org/get/silex.phar
View
264 vendor/silex/doc/services.rst
@@ -0,0 +1,264 @@
+Services
+========
+
+Silex is not only a microframework. It is also a micro service container.
+It does this by extending `Pimple <https://github.com/fabpot/Pimple>`_
+which provides service goodness in just 44 NCLOC.
+
+Dependency Injection
+--------------------
+
+.. note::
+
+ You can skip this if you already know what Dependency Injection is.
+
+Dependency Injection is a design pattern where you pass dependencies
+to services instead of creating them from within the service or
+relying on globals. This generally leads to code that is decoupled,
+re-usable, flexible and testable.
+
+Here is an example of a class that takes a ``User`` object and stores
+it as a file in JSON format::
+
+ class JsonUserPersister
+ {
+ private $basePath;
+
+ public function __construct($basePath)
+ {
+ $this->basePath = $basePath;
+ }
+
+ public function persist(User $user)
+ {
+ $data = $user->getAttributes();
+ $json = json_encode($data);
+ $filename = $this->basePath.'/'.$user->id.'.json';
+ file_put_contents($filename, $json, LOCK_EX);
+ }
+ }
+
+In this simple example the dependency is the ``basePath`` property.
+It is passed to the constructor. This means you can create several
+independent instances with different base paths. Of course
+dependencies do not have to be simple strings. More often they are
+in fact other services.
+
+Container
+~~~~~~~~~
+
+A DI or service container is responsible for creating and storing
+services. It can recursively create dependencies of the requested
+services and inject them. It does so lazily, which means a service
+is only created when you actually need it.
+
+Most containers are quite complex and are configured through XML
+or YAML files.
+
+Pimple is different.
+
+Pimple
+------
+
+Pimple is probably the simplest service container out there. It
+makes strong use of closures implements the ArrayAccess interface.
+
+We will start off by creating a new instance of Pimple -- and
+because ``Silex\Application`` extends ``Pimple`` all of this
+applies to Silex as well. ::
+
+ $container = new Pimple();
+
+or ::
+
+ $app = new Silex\Application();
+
+Parameters
+~~~~~~~~~~
+
+You can set parameters (which are usually strings) by setting
+an array key on the container::
+
+ $app['some_parameter'] = 'value';
+
+The array key can be anything, by convention periods are
+used for namespacing. ::
+
+ $app['asset.host'] = 'http://cdn.mysite.com/';
+
+Reading parameter values is possible with the same
+syntax. ::
+
+ echo $app['some_parameter'];
+
+Service definitions
+~~~~~~~~~~~~~~~~~~~
+
+Defining services is no different than defining parameters.
+You just set an array key on the container to be a closure.
+However, when you retrieve the service, the closure is executed.
+This allows for lazy service creation.
+
+::
+
+ $app['some_service'] = function () {
+ return new Service();
+ };
+
+And to retrieve the service, use::
+
+ $service = $app['some_service'];
+
+Every time you call ``$app['some_service']``, a new instance
+of the service is created.
+
+Shared services
+~~~~~~~~~~~~~~~
+
+You may want to use the same instance of a service across all
+of your code. In order to do that you can make a *shared*
+service. ::
+
+ $app['some_service'] = $app->share(function () {
+ return new Service();
+ });
+
+This will create the service on first invocation, and then
+return the existing instance on any subsequent access.
+
+Access container from closure
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In many cases you will want to access the service container
+from within a service definition closure. For example when
+fetching services the current service depends on.
+
+Because of this, the container is passed to the closure as
+an argument. ::
+
+ $app['some_service'] = function ($app) {
+ return new Service($app['some_other_service'], $app['some_service.config']);
+ };
+
+Here you can see an example of Dependency Injection.
+``some_service`` depends on ``some_other_service`` and
+takes ``some_service.config`` as configuration options.
+The dependency is only created when ``some_service`` is
+accessed, and it is possible to replace either of the
+dependencies by simply overriding those definitions.
+
+.. note::
+
+ This also works for shared services.
+
+Protected closures
+~~~~~~~~~~~~~~~~~~
+
+Because the container sees closures as factories for
+services, it will always execute them when reading them.
+
+In some cases you will however want to store a closure
+as a parameter, so that you can fetch it and execute it
+yourself -- with your own arguments.
+
+This is why Pimple allows you to protect your closures
+from being executed, by using the ``protect`` method.
+
+::
+
+ $app['closure_parameter'] = $app->protect(function ($a, $b) {
+ return $a + $b;
+ });
+
+ // will not execute the closure
+ $add = $app['closure_parameter'];
+
+ // calling it now
+ echo $add(2, 3);
+
+Note that protected closures do not get access to
+the container.
+
+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 `Request
+ <http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/Request.html>`_.
+ It gives you access to ``GET``, ``POST`` parameters
+ and lots more!
+
+ Example usage::
+
+ $id = $app['request']->get('id');
+
+ This is only available when a request is being served, you can only access it
+ from within a controller, before filter, after filter or error handler.
+
+* **autoloader**: This service provides you with a
+ `UniversalClassLoader
+ <http://api.symfony.com/2.0/Symfony/Component/ClassLoader/UniversalClassLoader.html>`_
+ that is already registered. You can register prefixes
+ and namespaces on it.
+
+ Example usage, autoloads Twig classes::
+
+ $app['autoloader']->registerPrefix('Twig_', $app['twig.class_path']);
+
+ For more information, check out the `Symfony autoloader documentation
+ <http://symfony.com/doc/2.0/cookbook/tools/autoloader.html>`_.
+
+* **routes**: The `RouteCollection
+ <http://api.symfony.com/2.0/Symfony/Component/Routing/RouteCollection.html>`_
+ that is used internally. You can add, modify, read
+ routes.
+
+* **controllers**: The ``Silex\ControllerCollection``
+ that is used internally. Check the *Internals*
+ chapter for more information.
+
+* **dispatcher**: The `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 `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 `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.
+
+* **request_context**: The request context is a simplified representation
+ of the request that is used by the Router and the UrlGenerator.
+
+.. note::
+
+ All of these Silex core services are shared.
+
+Core parameters
+---------------
+
+* **request.http_port** (optional): Allows you to override the default port
+ for non-HTTPS URLs. If the current request is HTTP, it will always use the
+ current port.
+
+ Defaults to 80.
+
+ This parameter can be used by the ``UrlGeneratorExtension``.
+
+* **request.https_port** (optional): Allows you to override the default port
+ for HTTPS URLs. If the current request is HTTPS, it will always use the
+ current port.
+
+ Defaults to 443.
+
+ This parameter can be used by the ``UrlGeneratorExtension``.
View
185 vendor/silex/doc/testing.rst
@@ -0,0 +1,185 @@
+Testing
+=======
+
+Because Silex is built on top of Symfony2, it is very easy to write functional
+tests for your application. Functional tests are automated software tests that
+ensure that your code is working correctly. They go through the user interface,
+using a fake browser, and mimic the actions a user would do.
+
+Why
+---
+
+If you are not familiar with software tests, you may be wondering why you would
+need this. Every time you make a change to your application, you have to test
+it. This means going through all the pages and making sure they are still
+working. Functional tests save you a lot of time, because they enable you to
+test your application in usually under a second by running a single command.
+
+For more information on functional testing, unit testing, and automated
+software tests in general, check out `PHPUnit <https://github.com/sebastianbergmann/phpunit>`_
+and `Bulat Shakirzyanov's talk on Clean Code <http://www.slideshare.net/avalanche123/clean-code-5609451>`_.
+
+PHPUnit
+-------
+
+`PHPUnit <https://github.com/sebastianbergmann/phpunit>`_
+is the de-facto standard testing framework for PHP. It was built for
+writing unit tests, but it can be used for functional tests too. You write
+tests by creating a new class, that extends the ``PHPUnit_Framework_TestCase``.
+Your test cases are methods prefixed with ``test``.
+
+::
+
+ class ContactFormTest extends PHPUnit_Framework_TestCase
+ {
+ public function testInitialPage()
+ {
+ ...
+ }
+ }
+
+In your test cases, you do assertions on the state of what you are testing. In
+this case we are testing a contact form, so we would want to assert that the
+page loaded correctly and contains our form.
+
+::
+
+ public function testInitialPage()
+ {
+ $statusCode = ...
+ $pageContent = ...
+
+ $this->assertEquals(200, $statusCode);
+ $this->assertContains('Contact us', $pageContent);
+ $this->assertContains('<form', $pageContent);
+ }
+
+Here you see some of the available assertions. There is a full list available
+in the `Writing Tests for PHPUnit
+<http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html>`_
+section of the PHPUnit documentation.
+
+WebTestCase
+-----------
+
+Symfony2 provides a WebTestCase class that can be used to write functional
+tests. The Silex version of this class is ``Silex\WebTestCase``, and you can
+use it by making your test extend it::
+
+ use Silex\WebTestCase;
+
+ class ContactFormTest extends WebTestCase
+ {
+ ...
+ }
+
+.. note::
+
+ To make your application testable, you need to make sure you follow "Reusing
+ applications" instructions from :doc:`usage`.
+
+For your WebTestCase, you will have to implement a ``createApplication``
+method, which returns your application. It will probably look like this::
+
+ public function createApplication()
+ {
+ return require __DIR__.'/path/to/app.php';
+ }
+
+Make sure you do **not** use ``require_once`` here, as this method will be
+executed before every test.
+
+The WebTestCase provides a ``createClient`` method. A client acts as a browser,
+and allows you to interact with your application. Here's how it works::
+
+ public function testInitialPage()
+ {
+ $client = $this->createClient();
+ $crawler = $client->request('GET', '/');
+
+ $this->assertTrue($client->getResponse()->isOk());
+ $this->assertEquals(1, count($crawler->filter('h1:contains("Contact us")')));
+ $this->assertEquals(1, count($crawler->filter('form')));
+ ...
+ }
+
+There are several things going on here. You have both a ``Client`` and a
+``Crawler``.
+
+You can also access the application through ``$this->app``.
+
+Client
+------
+
+The client represents a browser. It holds your browsing history, cookies and
+more. The ``request`` method allows you to make a request to a page on your
+application.
+
+.. note::
+
+ You can find some documentation for it in `the client section of the testing
+ chapter of the Symfony2 documentation
+ <http://symfony.com/doc/current/book/testing.html#the-test-client>`_.
+
+Crawler
+-------
+
+The crawler allows you to inspect the content of a page. You can filter it
+using CSS expressions and lots more.
+
+.. note::
+
+ You can find some documentation for it in `the crawler section of the testing
+ chapter of the Symfony2 documentation
+ <http://symfony.com/doc/current/book/testing.html#the-test-client>`_.
+
+Configuration
+-------------
+
+The suggested way to configure PHPUnit is to create a ``phpunit.xml.dist``
+file, a ``tests`` folder and your tests in ``tests/YourApp/Tests/YourTest.php``.
+The ``phpunit.xml.dist`` file should look like this:
+
+.. code-block:: xml
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ >
+ <testsuites>
+ <testsuite name="YourApp Test Suite">
+ <directory>./tests/</directory>
+ </testsuite>
+ </testsuites>
+ </phpunit>
+
+You can also configure a bootstrap file for autoloading and whitelisting for
+code coverage reports.
+
+Your ``tests/YourApp/Tests/YourTest.php`` should look like this::
+
+ namespace YourApp\Tests;
+
+ use Silex\WebTestCase;
+
+ class YourTest extends WebTestCase
+ {
+ public function createApplication()
+ {
+ return require __DIR__.'/../../../app.php';
+ }
+
+ public function testFooBar()
+ {
+ ...
+ }
+ }
+
+Now, when running ``phpunit`` on the command line, your tests should run.
View
583 vendor/silex/doc/usage.rst
@@ -0,0 +1,583 @@
+Usage
+=====
+
+This chapter describes how to use Silex.
+
+Bootstrap
+---------
+
+To include the Silex all you need to do is require the ``silex.phar``
+file and create an instance of ``Silex\Application``. After your
+controller definitions, call the ``run`` method on your application.
+
+::
+
+ require_once __DIR__.'/silex.phar';
+
+ $app = new Silex\Application();
+
+ // definitions
+
+ $app->run();
+
+One other thing you have to do is configure your web server. If you
+are using apache you can use a ``.htaccess`` file for this.
+
+.. code-block:: apache
+
+ <IfModule mod_rewrite.c>
+ Options -MultiViews
+
+ RewriteEngine On
+ #RewriteBase /path/to/app
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^(.*)$ index.php [QSA,L]
+ </IfModule>
+
+.. note::
+
+ If your site is not at the webroot level you will have to uncomment the
+ ``RewriteBase`` statement and adjust the path to point to your directory,
+ relative from the webroot.
+
+Routing
+-------
+
+In Silex you define a route and the controller that is called when that
+route is matched
+
+A route pattern consists of:
+
+* *Pattern*: The route pattern defines a path that points to a resource.
+ The pattern can include variable parts and you are able to set
+ RegExp requirements for them.
+
+* *Method*: One of the following HTTP methods: ``GET``, ``POST``, ``PUT``
+ ``DELETE``. This describes the interaction with the resource. Commonly
+ only ``GET`` and ``POST`` are used, but it is possible to use the
+ others as well.
+
+The controller is defined using a closure like this::
+
+ function () {
+ // do something
+ }
+
+Closures are anonymous functions that may import state from outside
+of their definition. This is different from globals, because the outer
+state does not have to be global. For instance, you could define a
+closure in a function and import local variables of that function.
+
+.. note::
+
+ Closures that do not import scope are referred to as lambdas.
+ Because in PHP all anonymous functions are instances of the
+ ``Closure`` class, we will not make a distinction here.
+
+The return value of the closure becomes the content of the page.
+
+There is also an alternate way for defining controllers using a
+class method. The syntax for that is ``ClassName::methodName``.
+Static methods are also possible.
+
+Example GET route
+~~~~~~~~~~~~~~~~~
+
+Here is an example definition of a ``GET`` route::
+
+ $blogPosts = array(
+ 1 => array(
+ 'date' => '2011-03-29',
+ 'author' => 'igorw',
+ 'title' => 'Using Silex',
+ 'body' => '...',
+ ),
+ );
+
+ $app->get('/blog', function () use ($blogPosts) {
+ $output = '';
+ foreach ($blogPosts as $post) {
+ $output .= $post['title'];
+ $output .= '<br />';
+ }
+
+ return $output;
+ });
+
+Visiting ``/blog`` will return a list of blog post titles. The ``use``
+statement means something different in this context. It tells the
+closure to import the $blogPosts variable from the outer scope. This
+allows you to use it from within the closure.
+
+Dynamic routing
+~~~~~~~~~~~~~~~
+
+Now, you can create another controller for viewing individual blog
+posts::
+
+ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+
+ $app->get('/blog/show/{id}', function ($id) use ($blogPosts) {
+ if (!isset($blogPosts[$id])) {
+ throw new NotFoundHttpException();
+ }
+
+ $post = $blogPosts[$id];
+
+ return "<h1>{$post['title']}</h1>".
+ "<p>{$post['body']}</p>";
+ });
+
+This route definition has a variable ``{id}`` part which is passed
+to the closure.
+
+As you can see, we are throwing a ``NotFoundHttpException`` if the
+post does not exist. We will see how to handle this later on.
+
+Example POST route
+~~~~~~~~~~~~~~~~~~
+
+POST routes signify the creation of a resource. An example for this is a
+feedback form. We will use `Swift Mailer
+<http://swiftmailer.org/>`_ and assume a copy of it to be present in the
+``vendor/swiftmailer`` directory.
+
+::
+
+ require_once __DIR__.'/vendor/swiftmailer/lib/swift_required.php';
+
+ use Symfony\Component\HttpFoundation\Response;
+
+ $app->post('/feedback', function () use ($app) {
+ $request = $app['request'];
+
+ $message = \Swift_Message::newInstance()
+ ->setSubject('[YourSite] Feedback')
+ ->setFrom(array('noreply@yoursite.com'))
+ ->setTo(array('feedback@yoursite.com'))
+ ->setBody($request->get('message'));
+
+ $transport = \Swift_MailTransport::newInstance();
+ $mailer = \Swift_Mailer::newInstance($transport);
+ $mailer->send($message);
+
+ return new Response('Thank you for your feedback!', 201);
+ });
+
+It is pretty straight forward. We include the Swift Mailer library,
+set up a message and send that message.
+
+The current ``request`` service is retrieved using the array key syntax.
+You can find more information about services in the *Services* chapter.
+The request is an instance of `Request
+<http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/Request.html>`_,
+so you can fetch variables using the request's ``get`` method.
+
+Instead of returning a string we are returning an instance of
+`Response
+<http://api.symfony.com/2.0/Symfony/Component/HttpFoundation/Response.html>`_.
+This allows setting an HTTP
+status code, in this case it is set to ``201 Created``.
+
+.. note::
+
+ Silex always uses a ``Response`` internally, it converts strings to
+ responses with status code ``200 Ok``.
+
+Other methods
+~~~~~~~~~~~~~
+
+You can create controllers for most HTTP methods. Just call one of these
+methods on your application: ``get``, ``post``, ``put``, ``delete``. You
+can also call ``match``, which will match all methods.
+
+::
+
+ $app->put('/blog', function () {
+ ...
+ });
+
+.. note::
+
+ The order in which the routes are defined is significant. The first
+ matching route will be used, so place more generic routes at the bottom.
+
+Route variables
+~~~~~~~~~~~~~~~
+
+As has been show before you can define variable parts in a route like this::
+
+ $app->get('/blog/show/{id}', function ($id) {
+ ...
+ });
+
+It is also possible to have more than one variable part, just make sure the
+closure arguments match the names of the variable parts.
+
+::
+
+ $app->get('/blog/show/{postId}/{commentId}', function ($postId, $commentId) {
+ ...
+ });
+
+While it's not suggested, you could also do this (note the switched arguments)::
+
+ $app->get('/blog/show/{postId}/{commentId}', function ($commentId, $postId) {
+ ...
+ });
+
+Route variables converters
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Before injecting the route variables into the controller, you can apply some
+converters::
+
+ $app->get('/user/{id}', function ($id) {
+ // ...
+ })->convert('id', function ($id) { return (int) $id; });
+
+This is useful when you want to convert route variables to objects as it
+allows to reuse the conversion code across different controllers::
+
+ $userProvider = function ($id) {
+ return new User($id);
+ };
+
+ $app->get('/user/{user}', function (User $user) {
+ // ...
+ })->convert('user', $userProvider);
+
+ $app->get('/user/{user}/edit', function (User $user) {
+ // ...
+ })->convert('user', $userProvider);
+
+The converter callback also receives the ``Request`` as its second argument::
+
+ $callback = function ($post, Request $request) {
+ return new Post($request->attributes->get('slug'));
+ };
+
+ $app->get('/blog/{id}/{slug}', function (Post $post) {
+ // ...
+ })->convert('post', $callback);
+
+Requirements
+~~~~~~~~~~~~
+
+In some cases you may want to only match certain expressions. You can define
+requirements using regular expressions by calling ``assert`` on the
+``Controller`` object, which is returned by the routing methods.
+
+The following will make sure the ``id`` argument is numeric, since ``\d+``
+matches any amount of digits::
+
+ $app->get('/blog/show/{id}', function ($id) {
+ ...
+ })
+ ->assert('id', '\d+');
+
+You can also chain these calls::
+
+ $app->get('/blog/show/{postId}/{commentId}', function ($postId, $commentId) {
+ ...
+ })
+ ->assert('postId', '\d+')
+ ->assert('commentId', '\d+');
+
+Default values
+~~~~~~~~~~~~~~
+
+You can define a default value for any route variable by calling ``value`` on
+the ``Controller`` object.
+
+::
+
+ $app->get('/{pageName}', function ($pageName) {
+ ...
+ })
+ ->value('pageName', 'index');
+
+This will allow matching ``/``, in which case the ``pageName`` variable will
+have the value ``index``.
+
+Named routes
+~~~~~~~~~~~~
+
+Certain extensions (such as ``UrlGenerator``) can make use of named routes.
+By default Silex will generate a route name for you, that cannot really be
+used. You can give a route a name by calling ``bind`` on the ``Controller``
+object that is returned by the routing methods.
+
+::
+
+ $app->get('/', function () {
+ ...
+ })
+ ->bind('homepage');
+
+ $app->get('/blog/show/{id}', function ($id) {
+ ...
+ })
+ ->bind('blog_post');
+
+
+.. note::
+
+ It only makes sense to name routes if you use extensions that make use
+ of the ``RouteCollection``.
+
+Before and after filters
+------------------------
+
+Silex allows you to run code before and after every request. This happens
+through before and after filters. All you need to do is pass a closure::
+
+ $app->before(function () {
+ // set up
+ });
+
+ $app->after(function () {
+ // tear down
+ });
+
+Error handlers
+--------------
+
+If some part of your code throws an exception you will want to display
+some kind of error page to the user. This is what error handlers do. You
+can also use them to do additional things, such as logging.
+
+To register an error handler, pass a closure to the ``error`` method
+which takes an ``Exception`` argument and returns a response::
+
+ use Symfony\Component\HttpFoundation\Response;
+
+ $app->error(function (\Exception $e) {
+ return new Response('We are sorry, but something went terribly wrong.', 500);
+ });
+
+You can also check for specific errors by using ``instanceof``, and handle
+them differently::
+
+ use Symfony\Component\HttpFoundation\Response;
+ use Symfony\Component\HttpKernel\Exception\HttpException;
+ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+
+ $app->error(function (\Exception $e) {
+ if ($e instanceof NotFoundHttpException) {
+ return new Response('The requested page could not be found.', 404);
+ }
+
+ $code = ($e instanceof HttpException) ? $e->getStatusCode() : 500;
+ return new Response('We are sorry, but something went terribly wrong.', $code);
+ });
+
+If you want to set up logging you can use a separate error handler for that.
+Just make sure you register it before the response error handlers, because
+once a response is returned, the following handlers are ignored.
+
+.. note::
+
+ Silex ships with an extension for `Monolog <https://github.com/Seldaek/monolog>`_
+ which handles logging of errors. Check out the *Extensions* chapter
+ for details.
+
+Redirects
+---------
+
+You can redirect to another page by returning a redirect response, which
+you can create by calling the ``redirect`` method::
+
+ $app->get('/', function () use ($app) {
+ return $app->redirect('/hello');
+ });
+
+This will redirect from ``/`` to ``/hello``.
+
+Security
+--------
+
+Make sure to protect your application against attacks.
+
+Escaping
+~~~~~~~~
+
+When outputting any user input (either route variables GET/POST variables
+obtained from the request), you will have to make sure to escape it
+correctly, to prevent Cross-Site-Scripting attacks.
+
+* **Escaping HTML**: PHP provides the ``htmlspecialchars`` function for this.
+ Silex provides a shortcut ``escape`` method::
+
+ $app->get('/name', function () use ($app) {
+ $name = $app['request']->get('name');
+ return "You provided the name {$app->escape($name)}.";
+ });
+
+ If you use the Twig template engine you should use its escaping or even
+ auto-escaping mechanisms.
+
+* **Escaping JSON**: If you want to provide data in JSON format you should
+ use the PHP ``json_encode`` function::
+
+ use Symfony\Component\HttpFoundation\Response;
+
+ $app->get('/name.json', function () use ($app) {
+ $name = $app['request']->get('name');
+ return new Response(
+ json_encode(array('name' => $name)),
+ 200,
+ array('Content-Type' => 'application/json')
+ );
+ });
+
+Reusing applications
+--------------------
+
+To make your applications reusable, return the ``$app`` variable instead of
+calling the ``run()`` method::
+
+ // blog.php
+ require_once __DIR__.'/silex.phar';
+
+ $app = new Silex\Application();
+
+ // define your blog app
+ $app->get('/post/{id}', function ($id) { ... });
+
+ // return the app instance
+ return $app;
+
+Running this application can now be done like this::
+
+ $app = require __DIR__.'/blog.php';
+ $app->run();
+
+This pattern allows you to easily "mount" this application under any other
+one::
+
+ $blog = require __DIR__.'/blog.php';
+
+ $app = new Silex\Application();
+ $app->mount('/blog', $blog);
+
+ // define your main app
+
+ $app->run();
+
+Now, blog posts are available under the ``/blog/post/{id}`` route, along side
+any other routes you might have defined.
+
+If you mount many applications, you might want to avoid the overhead of
+loading them all on each request by using the ``LazyApplication`` wrapper::
+
+ $blog = new Silex\LazyApplication(__DIR__.'/blog.php');
+
+Console
+-------
+
+Silex includes a lightweight console for updating to the latest
+version.
+
+To find out which version of Silex you are using, invoke ``silex.phar`` on the
+command-line with ``version`` as an argument:
+
+.. code-block:: text
+
+ $ php silex.phar version
+ Silex version 0a243d3 2011-04-17 14:49:31 +0200
+
+To check that your are using the latest version, run the ``check`` command:
+
+.. code-block:: text
+
+ $ php silex.phar check
+
+To update ``silex.phar`` to the latest version, invoke the ``update``
+command:
+
+.. code-block:: text
+
+ $ php silex.phar update
+
+This will automatically download a new ``silex.phar`` from
+``silex-project.org`` and replace the existing one.
+
+Pitfalls
+--------
+
+There are some things that can go wrong. Here we will try and outline the
+most frequent ones.
+
+PHP configuration
+~~~~~~~~~~~~~~~~~
+
+Certain PHP distributions have restrictive default Phar settings. Setting
+the following may help.
+
+.. code-block:: ini
+
+ phar.readonly = Off
+ phar.require_hash = Off
+
+If you are on Suhosin you will also have to set this:
+
+.. code-block:: ini
+
+ suhosin.executor.include.whitelist = phar
+
+Phar-Stub bug
+~~~~~~~~~~~~~
+
+Some PHP installations have a bug that throws a ``PharException`` when trying
+to include the Phar. It will also tell you that ``Silex\Application`` could not
+be found. A workaround is using the following include line::
+
+ require_once 'phar://'.__DIR__.'/silex.phar/autoload.php';
+
+The exact cause of this issue could not be determined yet.
+
+ioncube loader bug
+~~~~~~~~~~~~~~~~~~
+
+Ioncube loader is an extension that can decode PHP encoded file.
+Unfortunately, old versions (prior to version 4.0.9) are not working well
+with phar archive.
+You must either upgrade Ioncube loder to version 4.0.9+ or disable it by
+commenting or removing this line in you php.ini file:
+
+.. code-block:: ini
+
+ zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so
+
+
+IIS configuration
+-----------------
+
+If you are using the Internet Information Services from Windows, you can use
+this sample ``web.config`` file:
+
+.. code-block:: xml
+
+ <?xml version="1.0"?>
+ <configuration>
+ <system.webServer>
+ <defaultDocument>
+ <files>
+ <clear />
+ <add value="index.php" />
+ </files>
+ </defaultDocument>
+ <rewrite>
+ <rules>
+ <rule name="Silex Front Controller" stopProcessing="true">
+ <match url="^(.*)$" ignoreCase="false" />
+ <conditions logicalGrouping="MatchAll">
+ <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
+ </conditions>
+ <action type="Rewrite" url="index.php" appendQueryString="true" />
+ </rule>
+ </rules>
+ </rewrite>
+ </system.webServer>
+ </configuration>
View
8 vendor/silex/example.htaccess
@@ -0,0 +1,8 @@
+<IfModule mod_rewrite.c>
+ Options -MultiViews
+
+ RewriteEngine On
+ #RewriteBase /path/to/app
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^(.*)$ index.php [QSA,L]
+</IfModule>
View
19 vendor/silex/phpunit.xml.dist
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ bootstrap="tests/bootstrap.php"
+>
+ <testsuites>
+ <testsuite name="Silex Test Suite">
+ <directory>./tests/Silex/</directory>
+ </testsuite>
+ </testsuites>
+</phpunit>
View
426 vendor/silex/src/Silex/Application.php
@@ -0,0 +1,426 @@
+<?php
+
+/*
+ * This file is part of the Silex framework.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Silex;
+
+use Symfony\Component\HttpKernel\HttpKernel;
+use Symfony\Component\HttpKernel\HttpKernelInterface;
+use Symfony\Component\HttpKernel\Controller\ControllerResolver;
+use Symfony\Component\HttpKernel\Event\KernelEvent;
+use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
+use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
+use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
+use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Symfony\Component\HttpKernel\KernelEvents;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RedirectResponse;
+use Symfony\Component\EventDispatcher\Event;
+use Symfony\Component\EventDispatcher\EventDispatcher;
+use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\Routing\Route;
+use Symfony\Component\Routing\RouteCollection;
+use Symfony\Component\Routing\RequestContext;
+use Symfony\Component\Routing\Exception\ExceptionInterface as RoutingException;
+use Symfony\Component\Routing\Exception\MethodNotAllowedException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
+use Symfony\Component\ClassLoader\UniversalClassLoader;
+use Silex\RedirectableUrlMatcher;
+
+/**
+ * The Silex framework class.
+ *
+ * @author Fabien Potencier <fabien@symfony.com>