Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

PHP Coding Standards, Autoloading (PSR-4) & Composer – Full PHP 8 Tutorial

87.2K views on YouTube

In this video, you will learn how to autoload your classes instead of using include & require statements. I’ll show you how autoloader works, how to register custom autoloader & then how to use composer to handle autoloading for you. In addition to autoloading, you will learn about coding standards (PSR) and dependency management using composer.

SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL
👍 Smash the like button
🤝 Subscribe to the channel & turn the notifications on
💬 Post comments, any feedback is greatly appreciated
⭐ Become a Patreon: https://www.patreon.com/programwithgio
THANK YOU!

LESSON 2.5
Course Outline – https://github.com/ggelashvili/learnphptherightway-outline
Course Playlist – https://www.youtube.com/playlist?list=PLr3d3QYzkw2xabQRUpcZ_IBk9W50M9pe-

RESOURCES
PSR-1 – https://www.php-fig.org/psr/psr-1/
PSR-4 – https://www.php-fig.org/psr/psr-4/
PSR-12 – https://www.php-fig.org/psr/psr-12/
Symfony Coding Standards Fixer – https://cs.symfony.com/
PHP Code Sniffer – https://pear.php.net/package/PHP_CodeSniffer/
Composer – https://getcomposer.org/
Versioning – https://getcomposer.org/doc/articles/versions.md
PHP Autoloading – https://www.php.net/manual/en/language.oop5.autoload.php
PEAR Coding Standards – https://pear.php.net/manual/en/standards.php
Symfony Coding Standards – https://symfony.com/doc/current/contributing/code/standards.html

For source, you can either use the code from https://github.com/ggelashvili/learnphptherightway-project/tree/2.1 as a starting base & build upon it following this lesson or you can use the one that’s already built at the end of section 2 for exercise: https://github.com/ggelashvili/learnphptherightway-project/tree/2.33

CHAPTERS
00:00 – Autoloading
05:52 – PSR
10:27 – Composer & dependency management
16:31 – Autoloading using composer