Time to go through some design patterns used wide in creating the applications. Why do they exists, anyway? Let's go to Observer pattern.See the example below, <?php // Observer interface interface Observer { public function update($message); } // Concrete Observers class EmailSubscriber implements Observer { private $email; public function __construct($email) { $this->email = $email; } public function update($message) { echo "Email sent to {$this->email}: $message\n"; } } class SMSSubscriber implements Observer { private $phone; public function __construct($phone) { $this->phone = $phone; } public function update($message) { echo "SMS sent to {$this->phone}: $message\n"; } } // Subject class NewsPublishe...
Prepare for your next job!! PHP,LARAVEL,MYSQL,VUEJS,React Js, AWS...lot more