Laravel: CQRS + Event Bus | DO NOT let your DB go brrrr..

  Рет қаралды 5,356

Przemysław Przyłucki

Przemysław Przyłucki

11 ай бұрын

👇 Code repo & details 👇
In this video we'll implement a simple CQRS system in Laravel:
- we'll utilize command bus, queries and commands
- we'll create separate read and write repositories
- we'll have tons of fun because the real CQRS is the friends we made along the way
Code repo:
github.com/saas-laravel/larav...
About me:
przemyslawprzylucki.com
More content (soon):
saaslaravel.com

Пікірлер: 42
@saimpots
@saimpots 11 ай бұрын
Please continue making videos like these exploring patterns, principles and architectures under the laravel prism. It's really, really useful, concise and easily digestible content!
@chriram2464
@chriram2464 9 ай бұрын
Yes, please :)
@medilies
@medilies 11 ай бұрын
This is the best channel to explore interesting patterns using Laravel
@saaslaravel
@saaslaravel 11 ай бұрын
Will see what I can do!
@josephmakram4342
@josephmakram4342 29 күн бұрын
This is awesome, i hope you deep dive on DDD on the next episodes
@roselyn123
@roselyn123 11 ай бұрын
now i can say that my skill is always a beignner whenever i watch your videos
@saaslaravel
@saaslaravel 11 ай бұрын
That's def not true! We're all faking it 😆
@niceteg
@niceteg 11 ай бұрын
As always, another grate piece for the brain! I Like your style and waiting your next video. Thanks!
@saaslaravel
@saaslaravel 11 ай бұрын
Thank you very much!
@ravernow
@ravernow 9 ай бұрын
Amazing content ! Each video is gem
@SemyonF89
@SemyonF89 5 ай бұрын
Man^ thanx a lot for share/explanation of your/common approach!
@devcast6414
@devcast6414 10 ай бұрын
Love this. Waiting for more
@mhmmdabrs6655
@mhmmdabrs6655 11 ай бұрын
awesome work 👏, thanks for sharing
@rahulxcr
@rahulxcr 11 ай бұрын
Thanks. That's very informative.
@marcusorjames
@marcusorjames 8 ай бұрын
Thanks for another great video
@andrewsmerdov453
@andrewsmerdov453 7 ай бұрын
How will it work if we use rabbitmq broker of the queue? Especially a command for reading users? Do we need extra logic for waiting answer from a queue? Thanks for the video!
@GergelyCsermely
@GergelyCsermely 10 ай бұрын
Thanks
@marcmaalouly771122
@marcmaalouly771122 9 ай бұрын
Love your videos! Can you tell me all plugins you use for phpstorm and the theme! Thank you❤
@saaslaravel
@saaslaravel 9 ай бұрын
The theme is called Catpuccin Mocchiato , as for the plugins I don't really run anything crazy but actions on save
@HieuNguyenTrung-ud6dj
@HieuNguyenTrung-ud6dj Ай бұрын
I think we should use RepositoryContract interfaces instead of Repository classes in the constructors of Handler classes.
@saaslaravel
@saaslaravel Ай бұрын
You're completely right! That was a brain fart on my end!
@albinopepegas8391
@albinopepegas8391 11 ай бұрын
Thanks, Now I can add CQRS to my resume 😂
@saaslaravel
@saaslaravel 11 ай бұрын
That's the way! Just make sure to build a todo app with it first to make it legit 😹
@jirikolapa4292
@jirikolapa4292 3 ай бұрын
How do you handle replica lag?
@user-er8px7mg3z
@user-er8px7mg3z 8 ай бұрын
Sir, why don't you define handle method in CommandHandler class and even though you don't, why does it work?
@silnexkr
@silnexkr 10 ай бұрын
This may be a dumb question, but is there any reason not to use the Laravel Model class in the repository?
@saaslaravel
@saaslaravel 10 ай бұрын
You can def do that as well! It's just the db wrapper has less magic and feels more aligned with the idea behind this solution
@99Spyder99
@99Spyder99 9 ай бұрын
Quick question, is event bus necessary for CQRS, can we do without it without the dispatcher? Isn't the event bus used for queue? I'm asking because for example you have a route which should return users? if get in queue doesn't take too much time to return the users?
@saaslaravel
@saaslaravel 9 ай бұрын
They don't have to be processed on the queue! In the video they were in sync
@99Spyder99
@99Spyder99 9 ай бұрын
I saw there were in sync, but wasn't sure, thanks for reply. Also if you don't mind, could you create a DDD + CQRS tutorial please, thank you@@saaslaravel
@pawelxyztemp
@pawelxyztemp 5 ай бұрын
Quality video Przemek, thanks for your work. As I'm exploring a topic of CQRS, I'm wondering ....Commands & Queries perform very narrow and encapsulated piece of work. So very quickly, even in a simple CRUD application, we will have a ton of commands. So we will end up with a huge array of mappings command to handlers?
@thefitnessway
@thefitnessway 5 ай бұрын
If you keep a convention around naming and folders, you can loop over the files in php and build the array dynamically. You should probably cache the results to avoid slowing down the app.
@spicynoodle7419
@spicynoodle7419 10 ай бұрын
Hot take, interfaces should have the primary name without any prefixes or suffixes and the implementation should have a meaningful and specific name like: interface ReadUserRepo class SqlReadUserRepo extends ReadUserRepo or class MockReadUserRepo extends ReadUserRepo
@saaslaravel
@saaslaravel 10 ай бұрын
I do like your hot take friend. I actually did both in that video 😂 Recently I've started doing things more and more your way and I'm enjoying it way more
@TheGajos
@TheGajos 9 ай бұрын
So what's the benefit of using it? "DO NOT let your DB go brrrr.."
@saaslaravel
@saaslaravel 9 ай бұрын
You can create read-only replicas to point your queries to and scale them more easily
@joao-pedro-alves
@joao-pedro-alves 2 ай бұрын
Almost none. This is a valid tutorial about CQRS but this pattern is really usefull in very specific scenarios. Most of the apps using Laravel will never face such scenarios, making this implementation completely unnecessary. This will only bring non sense complexity to your codebase.
@adamf6621
@adamf6621 11 ай бұрын
domain driven design tutorial please🙏. I have tried studying independently but failed to understand and what is on the internet is mostly theoretical and explains little thoroughly from a practical point of view🥲. I like this video because it practices the method👍.
@saaslaravel
@saaslaravel 11 ай бұрын
I'm not an expert on it by any means but this video is an intro to hexagonal architecture that I'm currently learning as well! Will share more as I learn more 💪
@al.e.k
@al.e.k 11 ай бұрын
​@@saaslaravel Btw, what kind of resources (books, courses , etc) do you use to learn hexagonal architecture? Can you recommend some of them?
@saaslaravel
@saaslaravel 11 ай бұрын
Just googling around and trying different stuff! Not big on courses or books :/
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 15 МЛН
WHO DO I LOVE MOST?
00:22
dednahype
Рет қаралды 81 МЛН
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 5 МЛН
Laravel app can't possibly be THIS good... [Free course: Great Laravel Apps #2]
34:44
100+ Linux Things you Need to Know
12:23
Fireship
Рет қаралды 273 М.
Refactoring to action pipelines in Laravel
1:25:03
Michael Dyrynda
Рет қаралды 9 М.
Event-Driven Architecture (EDA) vs Request/Response (RR)
12:00
Confluent
Рет қаралды 120 М.
Why Don't We Have A Laravel For JavaScript?
12:36
Theo - t3․gg
Рет қаралды 88 М.
Laravel: Repository Pattern in practice
27:13
Przemysław Przyłucki
Рет қаралды 10 М.
Refactor "Senior" PHP Code with Early Returns
12:09
Laravel Daily
Рет қаралды 26 М.
I switched to using a command bus
8:01
PHP Annotated
Рет қаралды 4,1 М.
Laravel + Service Pattern + DTOs = ❤️❤️❤️
17:52
Przemysław Przyłucki
Рет қаралды 43 М.
CQRS pitfalls and patterns - Udi Dahan - NDC Oslo 2023
59:26
NDC Conferences
Рет қаралды 23 М.
Неразрушаемый смартфон
1:00
Status
Рет қаралды 2,4 МЛН
GamePad İle Bisiklet Yönetmek #shorts
0:26
Osman Kabadayı
Рет қаралды 524 М.
Best mobile of all time💥🗿 [Troll Face]
0:24
Special SHNTY 2.0
Рет қаралды 2,9 МЛН