Chapter 18. Frameworks

An application framework is a set of functions, classes, and conventions that make it easier to accomplish common tasks. Lots of programming languages have popular frameworks, and PHP is no exception. This chapter provides an overview of three popular PHP frameworks. These frameworks speed your journey from nothing to a functioning web application.

Frameworks aimed at web development generally provide standard ways to accomplish at least the following tasks:

Routing
Translating user-requested URLs to specific methods or functions that are responsible for generating a response
Object-relational mapping
Letting you treat rows in your database as objects in your code and providing methods on those objects that modify the database
User management
Standard mechanisms for maintaining information about your app’s users and deciding which users have permission to do which operations

By using a framework, you save time compared to implementing all of the framework’s functionality yourself. You may also be able to jump-start new developers coming to work with you if they are familiar with the framework. The trade-off is that you must invest time in learning the framework and adapting to its conventions of how to accomplish things.

The three frameworks explored in this chapter are Laravel, Symfony, and Zend Framework. Each provides a very different kind of solution to the “framework” question. They differ in how they are installed, what their documentation ...

Get Learning PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.