Skip to content

Instantly share code, notes, and snippets.

View codeliner's full-sized avatar
🌐
OSS Contributor

Alexander Miertsch codeliner

🌐
OSS Contributor
View GitHub Profile
@Ocramius
Ocramius / Caddyfile
Last active March 11, 2024 22:14
Example docker + docker-compose + caddy + traefik setup that routes to multiple apps from one exposed HTTP port
:80 {
root /serve
}
{"nodes":[{"name":"Myriel","group":1},{"name":"Napoleon","group":1},{"name":"Mlle.Baptistine","group":1},{"name":"Mme.Magloire","group":1},{"name":"CountessdeLo","group":1},{"name":"Geborand","group":1},{"name":"Champtercier","group":1},{"name":"Cravatte","group":1},{"name":"Count","group":1},{"name":"OldMan","group":1},{"name":"Labarre","group":2},{"name":"Valjean","group":2},{"name":"Marguerite","group":3},{"name":"Mme.deR","group":2},{"name":"Isabeau","group":2},{"name":"Gervais","group":2},{"name":"Tholomyes","group":3},{"name":"Listolier","group":3},{"name":"Fameuil","group":3},{"name":"Blacheville","group":3},{"name":"Favourite","group":3},{"name":"Dahlia","group":3},{"name":"Zephine","group":3},{"name":"Fantine","group":3},{"name":"Mme.Thenardier","group":4},{"name":"Thenardier","group":4},{"name":"Cosette","group":5},{"name":"Javert","group":4},{"name":"Fauchelevent","group":0},{"name":"Bamatabois","group":2},{"name":"Perpetue","group":3},{"name":"Simplice","group":2},{"name":"Scaufflaire","group":2},
@mathiasverraes
mathiasverraes / rollyourown.php
Created May 30, 2018 14:17
We don't need no DIC libs / we don't need no deps control
<?php
// Context: I'm trying to argue that DI (and DIC) are great, and DIC libs suck.
// Happy to be proven wrong!
final class Router {
private $dependencies;
public function __construct (Dependencies $dependencies) {
$this->dependencies = $dependencies;
// You might say that this is Service Locator, but it's not. This router is toplevel,
// and toplevel must have access to dependencies. After that it can all just bubble nicely using proper DI.
@Miljar
Miljar / DocumentProjection.php
Created December 14, 2020 16:22
Prooph Projection state
DocumentReceiverWasRemoved::class => function ($state, DocumentReceiverWasRemoved $event) {
/** @var ReadModel $readModel */
$readModel = $this->readModel();
$receivers = array_filter(
$state[self::DOCUMENTS_KEY][$event->documentId()->toString()][self::DOCUMENT_RECEIVERS_KEY],
function ($receiver) use ($event) {
return $receiver['id'] !== $event->receiver()->value();
}
);
@cherifGsoul
cherifGsoul / Container.php
Last active January 3, 2017 18:35
Yii2 container decorated with container-interop
<?php
namespace app\components;
use Interop\Container\ContainerInterface;
class Container implements ContainerInterface
{
private $wrappedContainer;
function __construct($container)
@bluescreen
bluescreen / BroadwayProjectionRebuilder.php
Created September 23, 2014 19:01
Broadway Projection Rebuild
<?php
/**
* Projection Rebuilder
* @author Markus Muschol <markus.muschol@gmx.de>
*/
use Broadway\Domain\DateTime;
use Broadway\Domain\DomainEventStream;
use Broadway\Domain\DomainMessage;
use Broadway\Domain\Metadata;
use Broadway\EventHandling\EventBusInterface;
@guiwoda
guiwoda / EventStoreServiceProvider.php
Created January 22, 2016 20:44
Event store and Laravel
<?php
namespace App\Providers;
use Doctrine\DBAL\Connection;
use Illuminate\Contracts\Container\Container;
use Illuminate\Support\ServiceProvider;
use Prooph\Common\Event\ActionEvent;
use Prooph\Common\Event\ActionEventEmitter;
use Prooph\Common\Event\ActionEventListenerAggregate;
use Prooph\Common\Event\DetachAggregateHandlers;