Autoloading in Magento 2
- What is PSR?
- PSRs in Magento 2
- Autoloader with PSR-0 and PSR-4
- Autoloading in Magento 2
What is PSR and Why do we use it?
- The PHP Standard Recommendation (PSR) is a PHP specification published by the PHP Framework Interop Group. It serves the standardization of programming concepts in PHP.
- The aim is to enable interoperability of components and to provide a common technical basis for implementation of proven concepts for optimal programming and testing practices.
- The PHP Framework Interoperability Group was founded in 2009 to get the biggest PHP frameworks together to decide on commonalities between projects and make everybody’s life easier.
PSRs in Magento 2.
Magento 2 also uses almost PSRs of PHP.
Autoloader in Magento 2: PSR-0 and PSR-4.
– PSR-0 and PSR-4 are used to load the files automatically.
– PSR-0 has been marked as deprecated. PSR-4 is now recommended as an alternative.
You can read more here