Learning OOP in PHP
A collection of resources to learn object-oriented programming and related concepts for PHP developers. Please see CONTRIBUTING for details and contribute. ;)
Tutorials
OOP Fundamentals
Object-oriented programming fundamentals tutorials.
- Object Introduction (â–º) - An introduction about objects and related concepts.
- Intro To Object Associations (â–º) - An introduction about object associations.
- Object-Oriented Programming (â–º) - An introduction about object-oriented programming in general.
- Getting Started with OOP in PHP (â–º) - Object-oriented programming introduction in PHP.
- Beginning OOP in PHP (â–º) - Another object-oriented programming introduction in PHP.
- Intermediate OOP in PHP (â–º) - Intermediate concepts about object-oriented programming in PHP.
- PHP OOP Tutorials (â–º) - Tutorials about OOP, Design Patterns and MVC.
- PHP Object Oriented Programming Fundamentals (â–º$) - An introduction course about object-oriented programming in PHP.
- OOP Official PHP Reference - PHP official reference about object-oriented programming.
- Object-Oriented PHP for Beginners - A tutorial about OOP in PHP for beginners.
- Introduction to OOP Concepts and More - A tutorial about OOP and an introduction to UML and Design Patterns.
- From Procedural to Object Oriented PHP - A tutorial from procedural to object-oriented programming in PHP.
- OOP vs Procedural Code - Difference between OOP and procedural code.
OOP Advanced
Object-oriented programming advanced tutorials.
- What Are Abstract Classes? - A tutorial explaining abstract classes in PHP.
- Abstract Classes and Interfaces (â–º) - Introduction about abstract classes and interfaces.
- When should I code to an Interface? - A tutorial explaining what is and when to use interfaces in PHP.
- Understanding and Applying Polymorphism in PHP - A tutorial explaining about abstract classes, interfaces and polymorphism in PHP.
- Inheritance and Polymorphism Concepts (â–º) - An introduction about inheritance and polymorphism.
- Beyond Inheritance - A tutorial explaining what is inheritance and its types.
- The Clean Code Talks - Inheritance, Polymorphism, & Testing (â–º) - A tutorial about polymorphism and how it affects testing.
- PHP Namespaces Explained - A tutorial explaining how namespaces works in PHP.
- PHP Namespaces - A tutorial explaining what is and how namespaces works in PHP.
- PHP Namespaces in 120 Seconds Tutorial (â–º) - A 120 seconds long tutorial explaining what is and how to use namespaces in PHP.
- PSR-Huh? - An introduction about PSR standards.
- Autoloading in PHP and the PSR-0 Standard - An introduction about what is autoloading in PHP and the PSR-0 standard.
- Battle of the Autoloaders: PSR-0 vs. PSR-4 - A tutorial explaining the difference between PSR-0 and PSR-4 autoloader standards.
- PSR-4 Autoloading (â–º$) - A tutorial explaining PSR-4 autoloader standard.
- How Static Works in PHP (â–º) - An introduction on how static members work in PHP.
- When to Use Static Methods - A tutorial explaining when to use static methods in PHP.
- PHP Exceptions - An introduction about exceptions in PHP.
- When should you use an Exception? - A tutorial explaining when to use exceptions in PHP.
- Error Handling in PHP - An introduction about error handling in PHP and exceptions.
- What are PHP Magic Methods? - A tutorial explaining what is magic methods and examples on how to use them in PHP.
- Magic Methods and Predefined Constants in PHP - A tutorial about magic methods and predefined constants in PHP.
- What are PHP Traits? - A tutorial explaining what is and how to use traits in PHP.
- Using Traits in PHP 5.4 - Another tutorial explaining what is and how to use traits in PHP.
- The PHP Reflection API (â–º) - A tutorial explaining the PHP Reflection API.
- What is Reflection in PHP? - A tutorial explaining what is, when to use and some samples about reflection in PHP.
- Reflection in PHP - Another tutorial about reflection in PHP.
- UML 2.0 Tutorial (â–º) - An introduction tutorial about UML.
- UML - Another introduction tutorial about UML.
- Composer Primer - A complete tutorial about what is and how to use Composer.
- Easy Package Management With Composer - An introduction about Composer.
- Better Workflow in PHP With Composer, Namespacing, and PHPUnit - An introduction tutorial explaining how to use Composer, namespaces and PHPUnit in a PHP project.
- PHP Testing Basics (â–º) - An introduction about tests in PHP.
- Test-Driven PHP in Action (â–º$) - An introduction about test-driven development in PHP.
- OOP in PHP With Tests (â–º$) - A tutorial about OOP in PHP with tests.
- Introduction to PhpDoc - An introduction about code documentation in PHP.
- PHP & Enums (â–º) - An introduction about enums in PHP.
- Type Hinting in PHP - An introduction about type hinting in PHP.
- Introduction to Static and Dynamic Typing - A tutorial explaining static and dynamic typing in programming.
- Annotations in PHP: They Exist! (â–º) - An introduction to annotations in PHP.
Object-Oriented Design
Object-oriented design tutorials.
- Object-Oriented Design in PHP (â–º$) - An introduction to object-oriented design in PHP.
- Object Oriented Design Cheat Sheet - A cheat sheet about object-oriented design.
- Principles Of Object Oriented Design - An introduction to some principles about object-oriented design.
- Foundations Of OO Design - Some thoughts about object-oriented design.
- How to Write Code That Embraces Change - An introduction to OOD principles like cohesion, orthogonality, coupling, SOLID and others.
- Build seven good object-oriented habits in PHP - A tutorial about good habits in OOP in PHP.
- 3 Key Software Principles You Must Understand - An introduction to DRY, KISS and YAGNI principles.
- From STUPID to SOLID Code! - An introduction to SOLID principles.
- Don't be STUPID: GRASP SOLID! - An introduction to SOLID principles in PHP.
- Don't Be Stupid, Grasp Solid - Slides - An introduction to SOLID and other OOD principles in PHP.
- The SOLID Principles - A series of tutorials about SOLID principles in PHP.
- The Single Responsibility Principle - An introduction to Single Responsibility Principle in PHP.
- The Open/Closed Principle - An introduction to Open/Closed Principle in PHP.
- Constructors and Breaking the Liskov Substitution Principle - An introduction to Liskov Substitution Principle in PHP.
- Inversion of Control – The Hollywood Principle - An introduction to Inversion of Control Principle in PHP.
- The Dependency Inversion Principle - An introduction to Dependency Inversion Principle in PHP.
- SRP: The Single Responsibility Principle - An article explaining the Single Responsibility Principle.
- The Open-Closed Principle - An article explaining the Open/Closed Principle.
- The Liskov Substitution Principle - An article explaining the Liskov Substitution Principle.
- The Interface Segregation Principle - An article explaining the Interface Segregation Principle.
- The Dependency Inversion Principle - An article explaining the Dependency Inversion Principle.
- Inversion of Control Containers and the Dependency Injection Pattern - An article about Inversion of Control Containers and the Dependency Injection Pattern.
- DIP in the Wild - An article about Dependency Inversion Principle.
- Reducing Coupling - An article about reducing coupling.
- Tell Don't Ask - An introduction to Tell Don't Ask principle.
- Introduction to the Law of Demeter - An introduction to the Law of Demeter.
- You Aren't Gonna Need It - An introduction to YAGNI principle.
- Premature Optimization - An introduction to Premature Optimization anti-pattern.
- Primitive Obsession - An introduction to Primitive Obsession anti-pattern.
- God Class - An introduction to God Class anti-pattern.
- Object Calisthenics - An introduction to Object Calisthenics.
- Your code sucks, let's fix it! - An introduction to Object Calisthenics in PHP.
- Domain-Driven Design - An introduction to Domain-Driven Design.
- The Null Object Pattern - Polymorphism in Domain Models - An introduction to the Null Object Pattern in PHP.
- An Introduction to Services - An introduction to Services in PHP.
- Evolving Toward a Persistence Layer - An introduction to Persistence Layer implementation in PHP.
- Building a Domain Model – An Introduction to Persistence Agnosticism and Building a Domain Model – Integrating Data Mappers - A tutorial about creating a Domain Model in PHP.
- Handling Collections of Aggregate Roots – the Repository Pattern - An introduction to the Repository Pattern in PHP.
- Value Objects - An introduction to Value Objects in PHP.
- What is the difference between Entities and Value Objects? - A tutorial explaining the difference between Entities and Value Objects.
- What’s the difference between Active Record and Data Mapper? - A tutorial explaining the difference between Active Record and Data Mapper patterns.
- Managing Class Dependencies: An Introduction to Dependency Injection, Service Locators, and Factories, Part 1 and Managing Class Dependencies: An Introduction to Dependency Injection, Service Locators, and Factories, Part 2 - An introduction to Dependency Injection, Service Locators and Factories.
- Money Pattern: The Right Way to Represent Value-Unit Pairs - An introduction to the Money Pattern in PHP.
- Working with Money and Currency in PHP - A tutorial about how to work with Money and Currency in PHP.
- Working with Products, Orders and Sales in PHP - A tutorial about how to work with Products, Orders and Sales in PHP.
- Reusing Implementation – a Walk-through of Inheritance, Composition, and Delegation - A tutorial about code reusing and OOP in PHP.
- Design Tech Talk Series Presents: OO Design for Testability (â–º) - A talk about Object-Oriented Design a testability.
- The Clean Code Talks - Don't Look For Things! (â–º) - Another talk about Object-Oriented Design a testability.
- Programming With Anthony - Paradigm Soup (â–º) - An introduction to programming paradigms and its differences.
- Programming With Anthony - Dependency Injection (â–º) - An introduction to Dependency Injection.
- What is Dependency Injection? - An introduction to Dependency Injection in PHP.
- Dependency Injection with PHP 5.3 - Slides about Dependency Injection in PHP.
- Why use a Dependency Injection Container? - A tutorial of what is and when to use a Dependency Injection Container.
- Dependency Injection with Pimple - An introduction to Dependency Injection and how use Pimple for that.
- Dependency Injection Is Not The Same As The Dependency Inversion Principle - A tutorial explaining the difference between Dependency Injection and Dependency Inversion Principle.
- Catalog of Patterns of Enterprise Application Architecture - A catalog of Patterns of Enterprise Application Architecture.
Design Patterns
Design patterns tutorials.
- Design Patterns - A complete tutorial about design patterns.
- A Beginner's Guide to Design Patterns - An introduction tutorial to design patterns.
- Design Patterns - Programming With Anthony (â–º) - An introduction to design patterns.
- Beyond Design Patterns - Another introduction tutorial to design patterns.
- The Whens and Whys for PHP Design Patterns - A tutorial explaining why and when use design patterns in PHP.
- Design Patterns Workshop (â–º) - A workshop about design patterns in PHP.
- Design Patterns Video Tutorial (â–º) - A series about design patterns.
- PHP Design Patterns - Elements of Reusable Object-Oriented Software (â–º) - A series about design patterns in PHP.
- Agile Design Patterns (â–º$) - A series about design patterns in PHP.
- Design Patterns in PHP (â–º$) - Another series about design patterns in PHP.
- Introduction to Design Patterns with PHP - An introduction slide to SOLID and design patterns in PHP.
- Database Design Patterns - A slide about database design patterns in PHP.
- Design Patterns PHP - A collection of design patterns and some code implementation in PHP.
- Anti Patterns - A complete tutorial about anti patterns.
- Design Patterns with PHP - Adapters - A tutorial about Adapter pattern in PHP.
- Practical Aspects of the Adapter Pattern - Another tutorial about Adapter pattern in PHP.
- Understanding the Command Design Pattern - A tutorial about Command pattern in PHP.
- Understanding the Observer Pattern - A tutorial about Observer pattern in PHP.
- Iterators - Programming With Anthony (â–º) - An introduction to Iterator pattern in PHP.
- Iterators in PHP (â–º) - A talk about iterators in PHP.
- Mediators - Programming With Anthony - An introduction to Mediator pattern.
- Manage Complexity with the Facade Pattern - An introduction to Facade pattern in PHP.
- What are the benefits of using Repositories? - An introduction to Repository pattern in PHP.
- The Repository Design Pattern - A complete tutorial about Repository pattern in PHP.
- An Introduction to the Front Controller Pattern, Part 1 and An Introduction to the Front Controller Pattern, Part 2 - An introduction to Front Controller pattern in PHP.
- The Template Method Pattern - Override Strategy Logic - An introduction to Template method in PHP.
- What is the Factory Method Design Pattern? - An introduction to Factory pattern in PHP.
- What is the Decorator Pattern? - An introduction to Decorator pattern in PHP.
Refactoring
Refactoring tutorials.
- Refactoring - A complete tutorial guide about refactoring.
- Code Refactoring (â–º) - A series about code refactoring.
- Clean Code Refactoring (â–º) - A talk about refactoring and clean code in PHP.
- Refactoring Legacy Code - A tutorial series about refactoring legacy code with examples.
- Detecting Code Smells (â–º$) - A series about code smells in PHP.
- Techniques for Refactoring Code (â–º$) - A series about refactoring code in PHP.
- Workflows of Refactoring (â–º) - A talk about workflows of refactoring.
- Beyond Clean Code - An introduction about clean code.
- Catalog of Refactorings - A catalog of refactorings.
Architecture
Architecture tutorials.
- Create Your Own PHP Framework - A series of articles on how to create your own PHP framework.
- Creating Your Own MVC Series (â–º) - Another series on how to create your own PHP framework.
- A Beginner's Guide To MVC For The Web - A tutorial about MVC for the web.
- The MVC Pattern and PHP, Part 1 and The MVC Pattern and PHP, Part 2 - An introduction tutorial about MVC pattern.
- Alternatives To MVC - An introduction to alternative architectures to MVC.
- N-Tier Architecture - An Introduction - An introduction to n-tier architecture.
- Hexagonal Architecture - An introduction to Hexagonal Architecture in PHP.
Miscellaneous
Not related to OOP but interesting resources.
- Awesome PHP - A curated list of amazingly awesome PHP libraries, resources and shiny things.
- PHP The Right Way - A complete guide about the best practices and tutorials in PHP.
- PHP Lecture Slides - A complete and concise slide about PHP fundamentals, OOP, REST, Composer, MVC, Design Patterns, ORM, Security, OOD and testing in PHP.
- Functional Programming in PHP - An introduction to functional programming in PHP.
- Functional Programming and PHP - Another introduction to functional programming and concepts in PHP.
- What's In A Type - A tutorial about types and PHP.
- Data Structures for PHP Devs: Stacks and Queues - A tutorial about Stacks and Queues data structures in PHP.
- Data Structures for PHP Devs: Trees - A tutorial about Tree data structure in PHP.
- Data Structures for PHP Devs: Heaps - A tutorial about Heap data structure in PHP.
- Data Structures for PHP Devs: Graphs - A tutorial about Graph data structure in PHP.
- PHP Security Pitfalls (â–º$) - A series about security in PHP.
Videos
Videos about object-oriented programming and related concepts.
- ...more to come...
Slides
Slides about object-oriented programming and related concepts.
- The OOP in PHP - An introductory tutorial to OOP concepts and terminology using PHP's object model as an example.
Courses
Courses about object-oriented programming and related concepts.
- ...more to come...
Books
Fantastic and must-read books about object-oriented programming, analysis, design and related concepts.
- PHP Objects, Patterns, and Practices
- Head First Design Patterns
- Design Patterns: Elements of Reusable Object-Oriented Software
- Head First Object-Oriented Analysis and Design
- Agile Principles, Patterns, and Practices in C#
- Growing Object-Oriented Software, Guided by Tests
- Test Driven Development: By Example
- Clean Code: A Handbook of Agile Software Craftsmanship
- Refactoring: Improving the Design of Existing Code
- UML Distilled: A Brief Guide to the Standard Object Modeling Language
- Patterns of Enterprise Application Architecture
- Domain-Driven Design: Tackling Complexity in the Heart of Software
- The Pragmatic Programmer: From Journeyman to Master
- The Passionate Programmer: Creating a Remarkable Career in Software Development
People
Some fantastic and influential PHP and non-PHP developers.
- Adam Culp - Consultant at Zend Technologies and Sunshine PHP organizer.
- Alvaro Videla - Creator of PHP library for RabbitMQ and co-author of RabbitMQ in Action.
- Andi Gutmans - CEO and co-founder of Zend and PHP co-architect.
- Andy Hunt - One of the original authors of Agile Manifesto and co-author of The Pragmatic Programmer book.
- Anthony Ferrara - Co-author of PHP Internals book and Developer Advocate for Google.
- Benjamin Eberlei - Project-leader of Doctrine ORM and contributor to the Symfony2 Framework.
- Bernhard Schussek - Member of Symfony2 core development and creator of Puli library.
- Bruno Skvorc - Web developer and PHP editor in Sitepoint.
- Cal Evans - PHP developer and open source contributor.
- Chad Fowler - Developer, speaker and author of The Passionate Programmer book.
- Christophe Coevoet - Member of Symfony2 core development and open source contributor to projects like Doctrine ORM.
- David Zuelke - PHP developer at Heroku and regular speaker.
- Dayle Rees - Laravel evangelist and author of Laravel Code Bright and Code Happy books.
- Derick Rethans - Author of Xdebug and PHP engineer/evangelist on MongoDB.
- Erika Heidi - Author of Vagrant Cookbook and Phansible project and developer evangelist at Digital Ocean.
- Fabien Potencier - CEO and co-founder of SensioLabs and founder and project lead of Symfony Framework.
- Guilherme Blanco - PHP developer and open source contributor to projects like Doctrine ORM and Zend and Symfony frameworks.
- Hugo Hamon - PHP developer and head of training in SensioLabs.
- Igor Wiedler - Creator of Silex micro-framework and open-source contributor to projects like Symfony and Composer.
- Javier Eguiluz - Symfony evangelist in SensioLab and creator of easybook project.
- Jeffrey Way - Creator of Laracasts and Laravel contributor and evangelist.
- Jeremy Mikola - Engineer at MongoDB, open source contributor to projects like Doctrine ODM and Symfony Framework, and co-organizer of WurstCon.
- Johannes Schmitt - Founder of Scrutinizer CI and open source contributor to projects like Symfony.
- Jordi Boggiano - Founder of Toran Proxy, co-creator and project lead of Composer and Monolog and Symfony core developer.
- Josh Lockhart - Creator of Slim Framework and PHP The Right Way site.
- Julien Pauli - Co-author of PHP Internals book and open source contributor.
- Kent Beck - One of the original authors of Agile Manifesto and creator of Exteme Programming and Test Driven Development.
- Konstantin Kudryashov - Creator of Behat and PhpSpec test frameworks.
- Kris Wallsmith - PHP developer and creator of Assetic framework and Buzz library.
- Larry Garfield - PHP developer and core contributor of Drupal.
- Lukas Kahwe Smith - PHP developer and open source contributor to projects like Doctrine ORM and Symfony Framework.
- Marcello Duarte - PHP developer and co-creator of PhpSpec test framework.
- Martin Fowler - One of the original authors of Agile Manifesto and author of the best selling books about software engineering like Patterns of Enterprise Application Architecture and Refactoring books.
- Matthew Weier O'Phinney - Principal Enginner at Zend Technologies and project lead for Zend Framework and Apigility.
- Matthias Noback - PHP developer and author of books like A Year with Symfony and Principles of Package Design.
- Marco Pivetta - PHP developer and core team member of Doctrine ORM and team member of Zend Framework.
- Michael Dowling - Software enginner at Amazon Web Services and creator of Guzzle library.
- Mike van Riel - PHP developer and lead developer of phpDocumentor and Cilex projects.
- Nikita Popov - Co-author of PHP Internals book, open source contributor and creator of PHP Parser library.
- Nils Adermann - PHP developer and co-creator of Composer.
- Pablo Godel - PHP developer, open source contributor and co-organizer of Sunshine PHP.
- Paul Jones - PHP developer, creator of Aura PHP, open source contributor and author of Modernizing Legacy Applications in PHP.
- Phil Sturgeon - Founder of PyroCMS, open source contributor and author of Build APIs You Won't Hate book.
- Philip Brown - PHP developer and writer in Culttt website.
- Pádraic Brady - Creator of Mockery library and open source contributor to projects like Zend Framework.
- Rafael Dohms - PHP developer and evangelist, open source contributor and organizer of Amsterdam PHP.
- Rasmus Lerdorf - Creator of PHP and open source contributor.
- Rob Allen - PHP developer, Zend Framework contributor and co-author of Zend Framework in Action book.
- Robert C. Martin - One of the original authors of Agile Manifesto and author of the best selling books about software engineering like Clean Code and Agile Principles, Patterns, and Practices in C# books.
- Ryan Weaver - PHP developer, trainer and consultant at KnpLabs and member of Symfony core team.
- Sara Golemon - Open source contributor to projects like PHP runtime and HHVM and author of Extending and Embedding PHP book.
- Sebastian Bergmann - PHP developer, open source contributor and creator of PHPUnit test framework.
- Taylor Otwell - PHP developer and creator of Laravel Framework.
- Ward Cunningham - Programmer pioneer in Design Patterns and Extreme Programming.
- William Durand - PHP developer, open source contributor and creator of Geocoder library.
- Zeev Suraski - CTO and co-founder of Zend and PHP co-architect.
Some Questions
I found not related to PHP resources. Is this correct?
The project name is "Learning OOP in PHP". But, despite the name, object oriented programming is a concept related to a lot of other languages like C++, Java, C#, Python, Ruby and so on. That said, exists a lot of fantastic resources like videos and tutorials about object-oriented programming made in another programming languages and I considered reasonable include them here in this reference.
There are some tutorials that aren't in the correct section?
I tried to keep this reference as simple as possible and divided it in a few areas. But there are some problems! Feel free to make any suggestions and contribute.