PHP code example of gcdtech / usecases
1. Go to this page and download the library: Download gcdtech/usecases library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gcdtech / usecases example snippets
class DispatchOrderUseCase extends UseCase
{
private $emailProvider;
public function __construct(EmailProvider $email)
{
$this->emailProvider = $email;
}
public function execute(Order $order)
{
// ... Do something to despatch the order
$this->emailProvider->send(new DispatchEmail($order));
}
}
// Note no mention of the EmailProvider here...
DispatchOrderUseCase::create()->execute($order);