© Kelt Dockins 2017

Kelt Dockins, Design Patterns in PHP and Laravel, 10.1007/978-1-4842-2451-9_21

21. Memento

Kelt Dockins

(1)Dolph, Arkansas, USA

$> git checkout memento

Intent

Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later.1

Applications

Have you ever seen that movie called Memento 2? The story follows an investigator who can no longer make new memories. He follows clues in order to find a second attacker on his murdered wife. It’s not one of Christopher Nolan’s best movies but it is still worth watching. This chapter has nothing to do with that. I’m not even sure how to relate the movie with the memento pattern. I do love a good Nolan film, though.

Get Design Patterns in PHP and Laravel 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.