The Drupal 8 Developer Prep series picks up again with a look at some PHP coding standards. We'll continue to work with our Autoloader and explain why it's to our advantage to make sure it complies to the PHP Standards Recommendations (PSR) set out by the Framework Interoperability Group (FIG).
4 NEW videos added in "Drupal 8 Developer Prep"
Autoloading becomes much more powerful if all of the libraries you use expect the autoloader to work in the same way. To solve problems like creating standards around autoloading, the Framework Interoperability group was created, and the first recommendation they put out was to solve this particular problem.
PSR-0 has a cryptic sounding name, and the fact that it took a bunch of really smart people coming together to create it might imply that it should be dauntingly complicated, but it's not. In this video, we walk through each of the conditions and build an autoloader that fits the bill.
Even though the basics of autoloading are simple and we can build one on our own, there's some serious gains to be made by using a more mature autoloading solution. We talk about that a bit in this video.
To wrap up our OOP boot camp, we're going to take our own components and make them far more useful by conforming them to PSR-0 standards. What we end up with is going to look a lot like the code we built in our first Drupal 8 module example, but this time the structure is going to make a lot more sense.