Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Projecting events in Laravel (Laravel Live)
Freek Van der Herten
March 03, 2019
Programming
3
480
Projecting events in Laravel (Laravel Live)
Freek Van der Herten
March 03, 2019
Tweet
Share
More Decks by Freek Van der Herten
See All by Freek Van der Herten
An Introduction to Snapshot testing
freekmurze
0
220
Event Sourcing In Laravel
freekmurze
0
140
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
470
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
1
500
A practical look at multitenancy in Laravel
freekmurze
1
240
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
470
Highlights Flare codebase (Laracon online)
freekmurze
0
190
Introducing Mailcoach
freekmurze
1
390
Highlights from the Flare codebase (Full Stack Ghent)
freekmurze
0
420
Other Decks in Programming
See All in Programming
How GitHub Supports Vim License Detection, The Five Years Journey
othree
1
390
このタイミングで知っておきたい 開発生産性の高いエンジニア組織の特徴とは / dev-sumi-20220721-productivity-features
findyinc
7
2.7k
ECサイトの脆弱性診断をいい感じにやりたい/OWASPKansaiNight_LT1_220727
owaspkansai
0
300
How to Test Your Compose UI (Droidcon Berlin 2022)
stewemetal
1
130
SAM × Dockerでサーバーレス開発が超捗った話
yu_yukk_y
1
420
AWS Config Custom Rule、ノーコードでできるかな?
watany
0
250
FullStack eXchange, July 2022
brucel
0
200
「困りごと」から始める個人開発
ikumatadokoro
4
260
Recap CDN, Edge, WebAssembly | ワインと鍋.js#1
sadnessojisan
2
1.2k
Untangling Coroutine Testing (Droidcon Berlin 2022)
zsmb
2
490
レビュー駆動学習のススメ_StaPy#83
soogie
0
320
企業内スモールデータでのデータ解析
hamage9
0
910
Featured
See All Featured
Happy Clients
brianwarren
89
5.6k
Web development in the modern age
philhawksworth
197
9.3k
Learning to Love Humans: Emotional Interface Design
aarron
261
37k
Embracing the Ebb and Flow
colly
73
3.4k
A Modern Web Designer's Workflow
chriscoyier
689
180k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
498
130k
Intergalactic Javascript Robots from Outer Space
tanoku
260
25k
Rebuilding a faster, lazier Slack
samanthasiow
62
7.3k
A better future with KSS
kneath
226
16k
Build your cross-platform service in a week with App Engine
jlugia
219
17k
Typedesign – Prime Four
hannesfritz
34
1.4k
Documentation Writing (for coders)
carmenintech
48
2.6k
Transcript
Projecting events in Laravel
About me Freek Van der Herten Partner & developer at
Spatie @freekmurze https://murze.be https://ohdear.app
Spatie Since 2003 Websites, applications and webshops Team 9 awesome
human beings Specialisation Laravel, front-end development
Open Source Software
We create a lot of it ± 200 packages on
Packagist ± 2,000,000 downloads a month ± 25,000,000 total downloads All Postcardware!
Highlights Popular laravel-backup laravel-medialibrary laravel-permission New laravel-query-builder laravel-blade-x
https://spatie.be/open-source
https://spatie.be/open-source/postcards
Let's talk about projecting events
Talk overview Theory Laravel Event Projector demo
Theory
Traditional application Write data in database An update means overwriting
the old data The old data cannot be accessed anymore
APPLICATION DATABASE TABLE value X
APPLICATION DATABASE TABLE value X value Y
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
APP EVENTS Event Event 1
APP EVENTS Event Event 1 Event 2
APP EVENTS Event Event 1 Event 2 Event 3
APP CONSUMER EVENTS PROJECTION Event Event 1 Event 2 Event
3
APP CONSUMER CONSUMER 2 EVENTS PROJECTION Event Event 1 Event
2 Event 3 ANOTHER PROJECTION
APP CONSUMER CONSUMER 2 EVENTS PROJECTION Event Event 1 Event
2 Event 3 ANOTHER PROJECTION
APP CONSUMER CONSUMER 2 EVENTS PROJECTION Event Event 1 Event
2 Event 3 Event 4 ANOTHER PROJECTION
Projecting events Auditing requirements Extra reports needed There is some
setup required
Laravel Event Projector
Laravel Event Projector It's not full event sourcing, it focuses
on projections Beautifully integrated into Laravel Easy to get started with
https://docs.spatie.be/laravel-event-projector
Demo
In closing
Summary Easy to use package to get started with projections
Hooks into Laravel's native events Replay capabilities Writes are harder, reads are easier
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
Thank you! https://speakerdeck.com/freekmurze/projecting-events-in-laravel https://spatie.be/open-source https://murze.be https://ohdear.app https://fullstackeurope.com