Skip to content

Instantly share code, notes, and snippets.

View jsor's full-sized avatar
💨

Jan Sorgalla jsor

💨
View GitHub Profile
<?php
namespace React\Whois;
use Promise\Deferred as Deferred;
use React\Curry\Util as Curry;
use React\Dns\Resolver\Resolver;
class Client
{
$d1 = new Deferred();
$d2 = new Deferred();
When::all(
array('abc' => $d1->promise(), 1 => $d2->promise()),
$mock
);
$d2->resolve(2);
$d1->resolve(1);
<?php
namespace React\Stomp;
class Acknowledgement
{
private $client;
private $messageId;
private $subscriptionId;
@jsor
jsor / gist:4109766
Created November 19, 2012 09:14 — forked from igorw/gist:4108347
React v0.2.4 release notes

React v0.2.4 is more awesome

DNS promises

This release has two major improvements. The first one is that react/dns is now using a promise based API. In case you missed it, react/promise is a PHP library for promises. Take a look at the README and familiarize yourself with it, as it will be used by many libs in the react ecosystem, including core.

The previous API was:

$dns->resolve('igor.io', function ($ip) {

echo "Yay, the IP is $ip.\n";

@jsor
jsor / Connection.php
Last active April 27, 2018 07:12
Async MySQL Client
<?php
namespace Jsor\MysqlAsync;
use React\EventLoop\LoopInterface;
use React\Promise\Deferred;
class Connection
{
private $loop;
class RedisMonitor
{
private $redis;
public function __construct(Client $redis)
{
$this->redis = $redis;
}
public function __invoke()
<?php
use Predis\Async\Client as PredisClient;
function save(PredisClient $redis)
{
$deferred = new Deferred();
$tx = $redis->multiExec();
@jsor
jsor / example.php
Last active December 20, 2015 04:18
Interfaces for functions.
<?php
require __DIR__.'/function_interfaces.php';
interface foo {}
interface interfaces {
function my_function();
function my_function2(callable $callable, $string, \Traversable $traversable, foo $foo, $constant = DIRECTORY_SEPARATOR);
}
@jsor
jsor / settle.php
Created December 18, 2013 09:04
React\Promise\settle()
<?php
namespace React\Promise;
function settle($promisesOrValues)
{
return resolve($promisesOrValues)
->then(function ($array) {
if (!is_array($array) || !$array) {
return resolve([]);
@jsor
jsor / ddd_cqrs_event-sourcing_in_php.md
Last active March 1, 2026 09:08
DDD, CQRS and Event Sourcing in PHP

DDD, CQRS and Event Sourcing in PHP

  • Broadway - Infrastructure and testing helpers for creating CQRS and event sourced applications
  • EventCentric.Core - Event Sourcing and CQRS in PHP
  • LiteCQRS - Small convention based CQRS library for PHP
  • predaddy - Common DDD classes including an annotation driven message bus and tools for CQRS and Event Sourcing
  • ProophEventSourcing - Provides basic functionality for event-sourced aggregates
  • ProophEventStore - PHP 5.4+ EventStore Implementation
  • ProophServiceBus - PHP Enterprise Service Bus Implementation supporting CQRS and DDD