Skip to content

Instantly share code, notes, and snippets.

Ujjwal Ojha ojhaujjwal

Block or report user

Report or block ojhaujjwal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ddd_cqrs_event-sourcing_in_php.md

DDD, CQRS and Event Sourcing in PHP

  • ProophEventSourcing - Provides basic functionality for event-sourced aggregates
  • ProophServiceBus - PHP Enterprise Service Bus Implementation supporting CQRS and DDD
  • Broadway - Infrastructure and testing helpers for creating CQRS and event sourced applications
  • EventSauce - Pragmatic event sourcing for PHP
  • ProophEventMachine - The world's only CQRS / ES framework that lets you pick your Flavour ]* predaddy - Common DDD classes including an annotation driven message bus and tools for CQRS and Event Sourcing
  • mmasiukevich/service-bus - CQRS\Event Sourcing\Message based framework
@ojhaujjwal
ojhaujjwal / README.md
Last active Aug 13, 2018
Configure Xdebug with PHPStorm and Docker for Mac
View README.md

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
View commands.md
# 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
View docker-compose-dev.yml
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
View php-background-job-gist12.php
<?php
$eventDispatcher = new EventDispatcher();
$eventDispatcher->addListener(
Bernard\BernardEvents::INVOKE,
function(Bernard\Event\EnvelopeEvent $envelopeEvent) {
echo PHP_EOL . 'Processing: ' . $envelopeEvent->getEnvelope()->getClass();
}
);
View php-background-job-gist11.php
<?php
namespace App\Message;
use Bernard\Message;
abstract class AbstractMessage implements Message
{
public function getName()
{
return get_class($this);
View php-background-job-gist10.php
<?php
namespace App\Handler;
use App\Message\SendForgotPasswordEmail;
class SendForgotPasswordEmailHandler
{
private $mailer;
public function __construct(Mailer $mailer)
View php-background-job-gist9.php
<?php
use Bernard\Router\ClassNameRouter;
use Bernard\Consumer;
use Bernard\Queue\RoundRobinQueue;
use Bernard\Message;
/** @var Psr\Container\ContainerInterface */
$conatiner = ...
$router = new ClassNameRouter();
View php-background-job-gist8.php
<?php
$handlers = [
'SendForgotPasswordEmail' => App\Handler\SendForgotPasswordEmailHandler::class,
'SendImportantEmail' => App\Handler\SendImportantEmailHandler::class,
];
View php-background-job-gist6.php
<?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');
});
You can’t perform that action at this time.