Projecting events in Laravel (Laravel Live)

Projecting events in Laravel (Laravel Live)

A1b4b398630bbd32b77a82cbc37fae9a?s=128

Freek Van der Herten

March 03, 2019
Tweet

Transcript

  1. Projecting events in Laravel

  2. About me Freek Van der Herten Partner & developer at

    Spatie @freekmurze https://murze.be https://ohdear.app
  3. Spatie Since 2003 Websites, applications and webshops Team 9 awesome

    human beings Specialisation Laravel, front-end development
  4. Open Source 
 Software

  5. We create a lot of it ± 200 packages on

    Packagist ± 2,000,000 downloads a month ± 25,000,000 total downloads All Postcardware!
  6. Highlights Popular laravel-backup laravel-medialibrary laravel-permission New laravel-query-builder laravel-blade-x

  7. https://spatie.be/open-source

  8. https://spatie.be/open-source/postcards

  9. Let's talk about projecting events

  10. Talk overview Theory Laravel Event Projector demo

  11. Theory

  12. Traditional application Write data in database An update means overwriting

    the old data The old data cannot be accessed anymore
  13. APPLICATION DATABASE TABLE value X

  14. APPLICATION DATABASE TABLE value X value Y

  15. Using projectors The application will fire off events Events will

    get written in a dedicated store Events are passed to classes that can handle them
  16. APP EVENTS Event Event 1

  17. APP EVENTS Event Event 1 Event 2

  18. APP EVENTS Event Event 1 Event 2 Event 3

  19. APP CONSUMER EVENTS PROJECTION Event Event 1 Event 2 Event

    3
  20. APP CONSUMER CONSUMER 2 EVENTS PROJECTION Event Event 1 Event

    2 Event 3 ANOTHER PROJECTION
  21. APP CONSUMER CONSUMER 2 EVENTS PROJECTION Event Event 1 Event

    2 Event 3 ANOTHER PROJECTION
  22. APP CONSUMER CONSUMER 2 EVENTS PROJECTION Event Event 1 Event

    2 Event 3 Event 4 ANOTHER PROJECTION
  23. Projecting events Auditing requirements Extra reports needed There is some

    setup required
  24. Laravel 
 Event Projector

  25. Laravel Event Projector It's not full event sourcing, it focuses

    on projections Beautifully integrated into Laravel Easy to get started with
  26. https://docs.spatie.be/laravel-event-projector

  27. Demo

  28. In closing

  29. Summary Easy to use package to get started with projections

    Hooks into Laravel's native events Replay capabilities Writes are harder, reads are easier
  30. Resources https://kickstarter.engineering/event-sourcing-made-simple-4a2625113224 https://dev.to/barryosull/event-sourcing-what-it-is-and-why-its-awesome https://www.youtube.com/watch?v=28jmTeN3VYc https://github.com/eventsauce

  31. Thank you! https://speakerdeck.com/freekmurze/projecting-events-in-laravel https://spatie.be/open-source https://murze.be https://ohdear.app https://fullstackeurope.com