Skip to content

Instantly share code, notes, and snippets.

View ojhaujjwal's full-sized avatar

Ujjwal Ojha ojhaujjwal

View GitHub Profile
<?php
namespace App\Message;
use Bernard\Message;
class SendForgotPasswordEmail implements Message
{
private $user;
public function __construct(User $user)
<?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');
});
<?php
$handlers = [
'SendForgotPasswordEmail' => App\Handler\SendForgotPasswordEmailHandler::class,
'SendImportantEmail' => App\Handler\SendImportantEmailHandler::class,
];
<?php
use Bernard\Router\ClassNameRouter;
use Bernard\Consumer;
use Bernard\Queue\RoundRobinQueue;
use Bernard\Message;
/** @var Psr\Container\ContainerInterface */
$conatiner = ...
$router = new ClassNameRouter();
<?php
namespace App\Handler;
use App\Message\SendForgotPasswordEmail;
class SendForgotPasswordEmailHandler
{
private $mailer;
public function __construct(Mailer $mailer)
<?php
namespace App\Message;
use Bernard\Message;
abstract class AbstractMessage implements Message
{
public function getName()
{
return get_class($this);
<?php
$eventDispatcher = new EventDispatcher();
$eventDispatcher->addListener(
Bernard\BernardEvents::INVOKE,
function(Bernard\Event\EnvelopeEvent $envelopeEvent) {
echo PHP_EOL . 'Processing: ' . $envelopeEvent->getEnvelope()->getClass();
}
);
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
# 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
@ojhaujjwal
ojhaujjwal / README.md
Last active August 13, 2018 14:40
Configure Xdebug with PHPStorm and Docker for Mac

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