This project shows some basics using Domain events (part of Domain Driven Design) on top of Symfony and Doctrine. Used domain is a user's tasks (like to-do list). Here described a solution to record events in the Task entity and then dispatch them at the moment the Task is persisted and saved to the database.
composer install
In the project directory, you can run minimal set of unit tests:
./bin/phpunit
To use application, in the project directory run (requires Symfony CLI):
symfony server:start
curl -X GET 'http://127.0.0.1:8000/tasks';
curl -X POST 'http://127.0.0.1:8000/tasks' -H 'content-type: application/json' --data-binary '{"title":"My new task"}';
curl -X PUT 'http://127.0.0.1:8000/tasks/83d5c82d-4789-4ac5-8af3-9c6d44af6ab7' -H 'content-type: application/json' --data-binary '{"title":"Changed title"}';
curl -X DELETE 'http://127.0.0.1:8000/tasks/83d5c82d-4789-4ac5-8af3-9c6d44af6ab7';
While sending requests above you can also see useful log information. For example:
tail -f var/log/dev.log