Servant design pattern in PHP

Servant design pattern is a behavioral design pattern where multiple classes use the servant's class behavior to avoid repeating code (see: DRY). Behavior functionality is defined only in one place: In servant.

The servant design pattern is not a defined pattern in the Gang of Four (GoF) book. It is very similar to the command design pattern but with a somewhat different solution to the problem.

Servant design pattern UML

See also

Found a typo? Something wrong with this content?

Just fork and edit it.

Content of this work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Code snippets in examples are published under the CC0 1.0 Universal (CC0 1.0). Thanks to all contributors.