From the course: MVC Frameworks for Building PHP Web Applications

Introducing framework concepts

From the course: MVC Frameworks for Building PHP Web Applications

Start my 1-month free trial

Introducing framework concepts

- [Teacher] When learning about frameworks, there are a few core development concepts that will need to be understood, both when evaluating which framework to choose and in learning how to use a particular framework. Making these sort of one to one comparisons can be tricky given how the documentation is organized. But it's nonetheless extremely important if you're trying to determine which one to use. Fortunately, I've spent a lot of time putting this material together throughout the course. But understanding the development concepts which to look at these frameworks would be the first crucial step, so let's take a look at these. The first concept to take a look at is pattern usage. One thing to look at is it strict or flexibile? Some frameworks very strictly enforce the usage of MVC and patterns, while others allow a lot more flexibility in terms of code organization and naming conventions. For example, cake PHP has a very strict naming and code organization enforcement. Codeigniter is less strict regarding naming but does enforce MVC and Zend allows for non-MVC usage of its components. Code organization is another thing to look at. How is the code organized? Where do the different pieces of the application go and does it make sense to you? Data handling is another aspect of these frameworks you'll need to look at. What are the methods by which the data is handled and the database is accessed? Some of these environments will use Doctrine which is an ORM tool. Others have their own built in tools for handling databases and some have none at all so you're going to need to determine what exactly it is that you're looking for. Components. Components are classes that are going to come with the framework of your choosing. Some frameworks are very lightweight and don't have a lot of components. This can be an advantage in the fact that it helps you to organization your code but doesn't come with a lot of overhead. Whereas other frameworks might come with a lot of different pre-built components and a lot of different constructs for you. So this is one thing you're going to have to look at and determine if you need or not. Another concept to think about is modularity. Do you want to use the entire framework or do you want to use certain pieces of it? Some of these frameworks really enforce you to use an all or none attitude whereas others you can adapt pieces if you want here and there. Additionally, can you reuse items from one app to another? Some are more flexible than others. Another thing to look at is what's included in terms of the UI and view on a framework. Some frameworks come with their own templating tools, some use jQuery internally, others have absolutely nothing to say in terms of how you implement the view. Again, this is going to be a matter of preference but it's an important thing to look at when you're evaluating. Standards are another thing to take a look at. There's a consortium of developers that have come together called PHP-FIG, or Framework Interoperability Group. They've spent a lot of time putting together different standards for how frameworks handle one thing or another. Some of these frameworks very strictly implement these what they call PSRs, whereas others have chosen to override them or to ignore them altogether. Another standard that's in use by a lot of these frameworks is Composer. How internally they integrate it will vary from framework to framework, but this tool allows you to declare dependencies in your application and they can even help you with installation of the framework itself. All in all, there are a number of key concepts you'll need to understand when comparing frameworks and when you begin to use them. Among them are pattern usage, code organization, data handling mechanisms, availability of components, modularity, how they integrate the UI and developer tools. Understanding how a framework incorporates these elements will help you to understand how it works.

Contents