Hey, I have just reduced the price for all products. Let's prepare our programming skills for the post-COVID era. Check it out »

Command in PHP

Command is behavioral design pattern that converts requests or simple operations into objects.

The conversion allows deferred or remote execution of commands, storing command history, etc.



Usage examples: The Command pattern is pretty common in PHP code. It’s used for queueing tasks, tracking the history of executed tasks and performing the “undo”.

Identification: The Command pattern is recognizable by behavioral methods in an abstract/interface type (sender) which invokes a method in an implementation of a different abstract/interface type (receiver) which has been encapsulated by the command implementation during its creation. Command classes are usually limited to specific actions.

Command in Other Languages

Command in C# Command in C++ Command in Go Command in Java Command in Python Command in Ruby Command in Rust Command in Swift Command in TypeScript