Book Image

Mastering Symfony

Book Image

Mastering Symfony

Overview of this book

In this book, you will learn some lesser known aspects of development with Symfony, and you will see how to use Symfony as a framework to create reliable and effective applications. You might have developed some impressive PHP libraries in other projects, but what is the point when your library is tied to one particular project? With Symfony, you can turn your code into a service and reuse it in other projects. This book starts with Symfony concepts such as bundles, routing, twig, doctrine, and more, taking you through the request/response life cycle. You will then proceed to set up development, test, and deployment environments in AWS. Then you will create reliable projects using Behat and Mink, and design business logic, cover authentication, and authorization steps in a security checking process. You will be walked through concepts such as DependencyInjection, service containers, and services, and go through steps to create customized commands for Symfony's console. Finally, the book covers performance optimization and the use of Varnish and Memcached in our project, and you are treated with the creation of database agnostic bundles and best practices.
Table of Contents (17 chapters)
Mastering Symfony
Credits
About the Author
About the Reviewers
Index

Putting it all together


So now we have the required setup for gateway cache (or reverse proxy cache) and Doctrine cache. Let's see how we can apply both of them to a specific page.

Let's say we are inside the project page; some parts of it rarely change, such as the project title and descriptions, and some parts of it change a lot, such as new tasks, finished tasks, and current tasks.

Let Doctrine take care of the required metadata, query, and result caches on the database side and feed them to the template. We can define a relatively long expiry period for the page itself and feed it to the gateway cache. However, there is a problem here.

As the dynamic parts of the page change faster than other parts, we won't be able to see the real updates to that page.

If we try to fix the problem by making the expiry time shorter and adding a validation strategy, we will have another problem. As the page will be modified more often, the gateway cache states will turn stale more than they should and add...