me vs. Symfony2, our ups and downs
Bundles are the basic building block of every Symfony app. With a recommended and adopted directory structure and auto-config, you can get loads of new features into your app just by adding one line to
composer.json and another to your
You wonder how the creators of the bundles create such components? Sticking to a few rules will get you most of the way there. The rest is up to your coding skills!
What is the expected page load time of a Standard Edition Symfony application? How does it change in a production environment? How much time can be shaved off while not sacrificing whole components?
At foodpanda, we are prototyping a base for a new REST API and the following tests are executed against a skeleton which should be common for all requests, i.e. a Symfony secured Route (with the help of the FOSOAuthServerBundle) where the authentication provider makes a Redis query to verify an access token. The controller generates a JsonResponse by loading a result set from MySQL via DQL because unfortunately a good few milliseconds are added while booting the ORM. A few tricks are on the side of nginx and php-fpm, our web server setup, Apache won't be considered.
I'd like to redirect to the last request. For example, I have a form accesible from multiple pages and after submission I want to redirect the use to the page where he or she came from.
The standard Twig loader in a Symfony app loads templates from the app/ directory and from Bundle resources. To load them from an additional location, it is possible to add a custom loader.
Since Twig uses a single loader,
Twig_Loader_Chain is used to wrap the original loader and the new custom loader. The original loader is registered in the container as
twig.loader, the custom loader will be a configured instance of
Twig_Loader_Filesystem. The following configuration puts it altogether.