# Install docker-sync
sudo gem install docker-sync
# if you want to use the unison strategy instead of rsync strategy
brew install unison eugenmayer/dockersync/unox
docker-sync-stack start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Message; | |
use Bernard\Message; | |
class SendForgotPasswordEmail implements Message | |
{ | |
private $user; | |
public function __construct(User $user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use App\Message\SendForgotPassword; | |
use App\Message\SendImportantEmail; | |
$router = new SimpleRouter(); | |
$router->add('SendForgotPasswordEmail', function(SendForgotPassword $message) { | |
// $mailer = .... | |
// $mailer->sendMail($message->getUser()->getEmail(), 'subject', 'contents'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$handlers = [ | |
'SendForgotPasswordEmail' => App\Handler\SendForgotPasswordEmailHandler::class, | |
'SendImportantEmail' => App\Handler\SendImportantEmailHandler::class, | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bernard\Router\ClassNameRouter; | |
use Bernard\Consumer; | |
use Bernard\Queue\RoundRobinQueue; | |
use Bernard\Message; | |
/** @var Psr\Container\ContainerInterface */ | |
$conatiner = ... | |
$router = new ClassNameRouter(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Handler; | |
use App\Message\SendForgotPasswordEmail; | |
class SendForgotPasswordEmailHandler | |
{ | |
private $mailer; | |
public function __construct(Mailer $mailer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Message; | |
use Bernard\Message; | |
abstract class AbstractMessage implements Message | |
{ | |
public function getName() | |
{ | |
return get_class($this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$eventDispatcher = new EventDispatcher(); | |
$eventDispatcher->addListener( | |
Bernard\BernardEvents::INVOKE, | |
function(Bernard\Event\EnvelopeEvent $envelopeEvent) { | |
echo PHP_EOL . 'Processing: ' . $envelopeEvent->getEnvelope()->getClass(); | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "2" | |
services: | |
app-rsync: | |
volumes: | |
- appcode-rsync-sync:/var/www:nocopy # will be mounted on /var/www | |
# that the important thing | |
volumes: | |
appcode-rsync-sync: | |
external: true |
Add the following xdebug.ini in your docker container:
zend_extension=/usr/lib/php/20170718/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_connect_back=off
xdebug.idekey=debugit
xdebug.remote_host=docker.for.mac.localhost