One of the great things about object-oriented programming is the ability to reuse code by creating multiple instances of a class. When we make changes to a class, all instances will inherit those changes, so we only have to make the change once.


  • We need to understand the Registry design pattern and the problems it helps us to overcome.
  • We then need to build a Registry class to store object instances. This is an essential part of an efficient framework, so it will be our only focus in this chapter.


There will, however, be times when we expect to only use one instance of a given class. We can achieve this ...

Get Pro PHP MVC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.