LaravelDaily/Laravel-Roadmap-Learning-Path

How to implement design patterns in Laravel?

amitleuva1987 opened this issue · 4 comments

First of all, Thanks for providing roadmap for a laravel developer. It's one of the best available on the internet.

In the Senior Level Skills, there are design patterns. It's a great source to learn design patterns.

Is there a source for "how to implement these design patterns in Laravel? "

@amitleuva1987 I've been researching this subject a while ago and realized that there's no such thing as "design patterns in Laravel", it's mostly about structuring your PHP classes in a good old OOP way according to design patterns.

So if you want to strictly follow design patterns, you typically zoom out your thinking and stop thinking about your project as a Laravel project, but rather a PHP project.

So I decided to switch the topic to SOLID Code, including some design patterns, and released it as a course here: https://laraveldaily.teachable.com/p/solid-code-in-laravel

@PovilasKorop , Thank you very much for the explanation. I would also switch to the SOLID principles.

I also did not find anything regarding design patterns in Laravel. I mean there is no way to create an interface like we create models using the command 'php artisan make:model modelname'. If I need a new factory design, I have to create classes manually. There is no one command to fulfill this.

@amitleuva1987 yes, exactly, if you need an interface, you're creating not a Laravel thing, you're creating a PHP file.
If you need a factory design, it's a PHP thing, not Laravel.

Please close the issue if I answered "successfully" :)

@PovilasKorop , your answer is very helpful.

for those who are searching for the same stuff "how to implement design patterns in Laravel?". Below "urls" may help.

Reference URL
Reference URL