New! Using PSR-4 With Composer

New! Using PSR-4 With Composer

Aug 28, 2022

The PHP Standards Recommendations (called PSR) are a set of standards that aim to make certain aspects of working with PHP easier. They include things like coding standards (PSR-1), sending HTTP requests (PSR-7), and the autoloading standard PSR-4.

PSR-4 describes the ability to include PHP classes based on their file paths. This means that instead of manually including every class file you need, you can write an autoloader that will do this for you.

The key bits of information are the namespace and the name of the class. Using this information you can then look up and include the class you need as the code is running.

Read more here: https://www.hashbangcode.com/article/using-psr-4-composer

Enjoy this post?

Buy !# code (Hash Bang Code) a coffee

More from !# code (Hash Bang Code)