Join Drew Falkman for an in-depth discussion in this video Introducing framework concepts, part of MVC Frameworks for Building PHP Web Applications.
- 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 when learning how to use a particular Framework. Many of these sort of one to one comparisons can be really tricky, given how the documentation of everything is organized, and how they're structured. But, it's nonetheless extremely important if you're trying to determine which to use. Fortunately, I've spent many hours putting together this material for you throughout this course, but understanding the development concepts you will need to look at these Frameworks is a crucial first step.
Let's take a look at these. The first concept is Pattern usage. One of the ways that we break it down is strict or flexible. Some Frameworks strictly enforce the usage of MVC and other patterns, while others are more flexible in terms of how the code is orgnanized, and the naming conventions. For example, CakePHP has a very strict naming and code organization enforcement. CodeIgniter is less strict about the naming, but it does highly enforce the MVC pattern.
Another thing to look at, is how is the code organized. Does it make sense to you and your development style? Every Framework will organize things differently, so you'll need to evaluate this. Additionally, the model layer of a lot of these different PHP Frameworks varies. Some of them require you to code everything specific by hand, however you want to do it, using a basic Framework. Other Frameworks have a strict, built in methodology for handling it, including Object Relation Mapping tools, ORM, either home grown such as Laravels, Eloquent, or Doctrine, or another one.
Components are classes that are included within a Framework, and these can make all the difference when developing an application. They often give you shortcuts to building whole chunks of code, that otherwise, you would have to code yourself. So analyzing which components are available to you in a specific Framework, is going to be a key part of the process. Another thing to look at is Modularity. Do you have to use the entire Framework, or can you use it piecemeal? Some of these Frameworks will allow you to use their full stack Framework, and their components separately.
You can even embed their components into another Framework's MVC layer. User interface, and View Assistance. Another thing to look at, is whether the Framework has tools to help you with the UI layer. Some of them will come with dojo, or jQuery toolkits. Also, if you're building APIs, they may have ways of outputting JSON or XML, that can greatly simplify your coding process. The last important thing to look at is Standards.
In the last few years, PHP Standards group has arisen, called PSR, or PHP Standards Recommendation. These are put together by a group of developers called php-fig, the Framework Interoperability Group. This is a consortium of PHP developers that come from all of the major MVC frameworks that we discuss in this course, as well as others, and they get together to determine coding styles, and how to handle things like auto loaders and come up with standards so that the Frameworks are more interoperable.
Another standard that has risen over the last few years, is Composer. Composer is a tool for managing dependencies in PHP applications. It allows you to declare dependencies in your application. Then you can have Composer automatically download them for you. Frameworks that support Composer make it much easier to use their elements, as well as much easier to install in your own environment. So there are a number of key concepts you'll need to understand both when comparing Frameworks, and when you begin to learn them.
Among them are pattern usage, code organization data handling mechanisms, availability of components, modularity, UI helpers, and standards. Understanding how a Framework incorporates these elements, will help you to understand how it works.
- Why use a framework?
- Introducing MVC-framework concepts
- Examining each framework's components
- Setting up the software
- Walking through sample apps built in each framework
- Comparing frameworks