prooph micro
- less is more -
Alexander Miertsch
Founder and CEO of prooph software GmbH
Founder and core contributor prooph components
contact@prooph.de
prooph components
CQRS and Event Sourcing packages for PHP
Supported Web Frameworks
or any other framework/codebase supporting container-interop & interop-config
prooph team
Community
Join prooph
prooph micro
more:
Event Sourcing
uses:
+
PES
less:
OOP MVC DIC Modules/Bundles
Favorite Stack Today
flexible, scalable, fast
JS-Frontend
API Gateway
Websocket
Read
Write
Read
Write
Legend
Event Store
Document DB
Message Queue
Process Manager
Search Service
Write Model
Backend
API Gateway
Write
Service
PHP
Made for the web
PHP-FPM
PHP Process
f(ctx, req) -> res
PHP Process
f(ctx, req) -> res
PHP Process
f(ctx, req) -> res
PHP Process
f(ctx, req) -> res
Event Sourcing
From a functional point of view
PHP & ES
Perfect match
PHP Process
f(ctx, req) -> res
+
Command Handler
f(state, cmd) -> events
=
f(ctx, req, handleCmd) -> res
Command Handling PHP Process
ES with prooph & phunkie
Composition is the key
<?php
namespace Prooph\Micro\Kernel;
use Phunkie\Types\ImmList;
use Phunkie\Types\Kind;
use Phunkie\Validation\Validation;
use Prooph\Common\Messaging\Message;
use Prooph\EventStore\EventStore;
use function Phunkie\Functions\function1\compose;
//...
//Command dispatcher
return compose(
$handleCommand,
$enrichEvents,
$persistEvents,
$publishEvents)($command);
f(state, cmd) -> events
ES with prooph & phunkie
Command handling is transactional
//Command dispatcher
return function (Message $command)
use ($eventStore,
$snapshotStore,
$commandMap,
$publisher
): Validation {
//...
$pipe = function ()
use ($command,
$handleCommand,
$enrichEvents,
$persistEvents,
$publishEvents
) {
return compose(
$handleCommand,
//...
)($command);
};
return Attempt($pipe); // -> Success | Failure
};
Function as a Service
Event sourced Microservices
FPM
FPM
...
API Gateway
Infinite Scalability
f(ctx, req, handleCmd) -> res
f(ctx, req, handleCmd) -> res
f(ctx, req, handleCmd) -> res
f(ctx, req, handleCmd) -> res
f(ctx, req, handleCmd) -> res
f(ctx, req, handleCmd) -> res
Event Driven Microservices
React on Events
E1
E2
E3
E4
E5
Event Log
Document DB
Message Queue
Process Manager
Search Service
Services
subscribe
consume
Roadmap and Ideas
- Documentation
- More Tests
- 1.0 Release
- Case studies of production usage
- ReactPHP / Amp integration
- Usage of Nginx Unit
- Integration with OpenFaaS
- Your ideas ...
Thanks for listening
Questions?
prooph micro - less is more @ PHPDD 2017
By prooph
prooph micro - less is more @ PHPDD 2017
- 2,062