SOLID Principles in Laravel: 5 Examples (+ New Course!)

Поділитися
Вставка
  • Опубліковано 22 сер 2024

КОМЕНТАРІ • 96

  • @giacomogaravaglia6742
    @giacomogaravaglia6742 3 роки тому +89

    "I'm not in the mood to fix it." Everyone in their programming life has said it at least once!

    • @LaravelDaily
      @LaravelDaily  3 роки тому +15

      It's just that I know that I'm in the flow of shooting video, and if I break it to spend 15 minutes on diving into PhpStorm configs, the video quality will get worse when I get back :)

    • @SamBennettWebDeveloper
      @SamBennettWebDeveloper 3 роки тому +5

      @@LaravelDaily To fix some of the warnings. Instead of doing Model::all() and Model::where() always start with Model::query() i.e. Model::query()->where()

    • @LaravelDaily
      @LaravelDaily  3 роки тому +3

      Yes, that may help with some Eloquent methods (also Laravel IDE Helper may help), but in that particular case, it was a general screw up with PhpStorm .idea settings, it didn't recognize even the base Controller in Laravel.

    • @ran_velo
      @ran_velo 3 роки тому +5

      @@LaravelDaily Make a t-shirt with the phrase

  • @lynic-0091
    @lynic-0091 2 роки тому +29

    In only 21 minutes you're teaching something which looked so difficult and intimidating to me at first, and now I completely understand what SOLID means. You're one hell of a teacher. Thanks for the free content!

  • @daniyarbaizhaksynov9230
    @daniyarbaizhaksynov9230 2 роки тому +2

    The presentation of information is so simple and extensive that you are surprised at the skill of the narrator. True artisan)

  • @ZenAzou
    @ZenAzou 3 роки тому +13

    Kinda Self-taught here! I had lots of duplicate code on my project, in views, controllers, livewire components, etc. Now I'm applying what I've learned from you (services, form requests...) and it makes maintainability and changes so much easier! Thank you all the way from Senegal :D

  • @christiansenmarcus
    @christiansenmarcus Рік тому +2

    Best description of SOLID in Laravel I've seen. Thank you.

  • @yhaelopez
    @yhaelopez 3 роки тому +6

    I loved the way you explained SOLID. Finally, I can say that I'm starting to understand it.

  • @nirajgautam403
    @nirajgautam403 3 роки тому +2

    You are my inspiration of upgrading my coding standards daily. Thank you

  • @marcoantonio7634
    @marcoantonio7634 7 місяців тому

    I love how you explain the code, it really expands my knowledge

  • @JigarDhulla
    @JigarDhulla 3 роки тому +1

    Thank you. Agree it is not easy to find SOLID examples in PHP with real life examples. Thanks for this and the course.

  • @phanta5m
    @phanta5m 3 роки тому +1

    finally i can understand what is open close principle benefit. the codeis extended, no need to import or send another data to view again. thanks

  • @demiurgich
    @demiurgich 2 роки тому +1

    Thank you, Povilas! You are perfect simplifier! Even I could not explain those principles in more understandable way.

  • @TahsinAbrar
    @TahsinAbrar 3 роки тому +3

    Loved the "SOLID in Everyday Life" part. Because, we can learn SOLID from different sources. But very few told the thing that you told in this part - The real life dilemma.
    We actually need to talk to our future self. And also need to think about the next developer(s) who will work on this code.

    • @SilverPaladin
      @SilverPaladin 2 роки тому

      You might even say "Sometimes reality gets in the way of our idealism"

  • @i_m_denny_
    @i_m_denny_ Рік тому +1

    Hey Povilas,
    Brilliant Content!
    Thank you for sharing your knowledge.

  • @ghostza1209
    @ghostza1209 Рік тому +2

    Thanks i’ll enroll your corse shortly

  • @unitaxi1644
    @unitaxi1644 3 роки тому +1

    Very usefully and easy to understand! Thank you!
    Please make a video about Laravel websockets (Pusher). It will be great job!

    • @LaravelDaily
      @LaravelDaily  3 роки тому +5

      I will create a full course about it, later in 2021.

  • @bmtamim7818
    @bmtamim7818 3 роки тому +1

    I just waiting for that. I was very curious to know how SOLID will work with LARAVEL. Because, I saw that the D of SOLID always break when we write code..
    Thanks a lot, sir😍

  • @okz9908
    @okz9908 3 роки тому +1

    you really just doing a great explanations in your UA-cam channel

  • @codewithfongoh
    @codewithfongoh 2 роки тому +2

    Thank you so much. Always awesome learning from your channel. I look forward to making videos as awesome as yours in the near future. For now, i stick with the basic ones lol

  • @Diego-eb9we
    @Diego-eb9we Рік тому

    Best teacher ever. Thank you!

  • @salahuddinayubi3906
    @salahuddinayubi3906 3 роки тому

    you are my inspiration. please shoot a video on following topics.
    1) The common PHP or web server exploits and their solutions.
    2) Integration of multiple data sources and databases into one system.
    Thanks in advance.

    • @LaravelDaily
      @LaravelDaily  3 роки тому

      Sorry, those topics are not in plans, too narrow edge topics for my audience.

  • @eugenelviv7490
    @eugenelviv7490 Рік тому

    This is the best explanation I met

  • @TheHBR99
    @TheHBR99 2 роки тому

    Finally you made it easily understandable to me. Thanks a lot!

  • @user-zh2oz9fe4m
    @user-zh2oz9fe4m Рік тому

    I'm very grateful for your extremely useful videos!

  • @ironspider9026
    @ironspider9026 3 роки тому +1

    Very well explained the information here is pure gold. Thanks for sharing wish I could give 1k likes to the video.

  • @RehmanKhan-zv2rl
    @RehmanKhan-zv2rl 3 роки тому +2

    Sir! great effort, its very helpful, thanks.

  • @L-A-O-S
    @L-A-O-S 3 роки тому

    I always wanted to learn more about SOLID. Thanks!

  • @user-xz7vy5bz1x
    @user-xz7vy5bz1x 10 місяців тому

    Хороший английский, превосходное видео!
    Спаасибо

  • @GergelyCsermely
    @GergelyCsermely 3 роки тому +1

    Thanks, I'm happy to leran sometning new again :)

  • @phil86_
    @phil86_ 3 роки тому +1

    Great tutorial as always

  • @amra-dev
    @amra-dev 2 роки тому +2

    When you code, constantly ask yourself two questions:
    Question 1: Who and How will they use that code in the future?
    Question 2: What may change in the future?

  • @zoeebabaee
    @zoeebabaee 11 місяців тому

    Thank you so much 🙏🙏

  • @alexaverkiyev9099
    @alexaverkiyev9099 3 роки тому +1

    From my experience:
    Always typehint variables and typehint returns. The return should not be mixed.
    If working with 3rd party services - always use interfaces. Even when working with services like image upload ('Spatie medialibrary' for example), one day you might swap to something else. Better to create an interface and a class that controls that upload (in that case a class that talks to spatie medialibrary).

    • @LaravelDaily
      @LaravelDaily  3 роки тому +5

      I partly agree in theory, but in practice - how many times did you ACTUALLY, in real-life, had to swap media library (or similar example) to something else?
      In my experience, even if you do swap with something else, you usually have a different interface, because that other tool has different set of features or works in a different way.
      So, using interfaces BEFORE you have at least two implementations of that interface, in my opinion, is overengineering and premature optimization.

  • @MahmoudMohsab
    @MahmoudMohsab 2 роки тому +1

    great job as usual

  • @mohamedruzaik3483
    @mohamedruzaik3483 3 роки тому +1

    Sublime is perfect for showing code

  • @nerjuz
    @nerjuz 3 роки тому

    Readable, maintainable and TESTABLE!

    • @LaravelDaily
      @LaravelDaily  3 роки тому +2

      I think I need to shoot a separate video on how to make code testable. Thanks for the suggestion, added to the to-do list.

  • @butcherfirewaters
    @butcherfirewaters 3 роки тому +1

    this principle asked me when i apply position - Junior Laravel developer )

    • @LaravelDaily
      @LaravelDaily  3 роки тому

      And how did it go for you? :)

    • @butcherfirewaters
      @butcherfirewaters 3 роки тому

      ​@@LaravelDaily I knew only 1 principle and how to answer it and use it - single responsabilites ) Other responsabilities I missed(passed)
      And I didn't get a job ;)

    • @LaravelDaily
      @LaravelDaily  3 роки тому

      I don't think that missing principle was the main reason that you didn't get the job :) At least, that's not how I would hire/choose a junior :)

    • @butcherfirewaters
      @butcherfirewaters 3 роки тому

      @@LaravelDaily ))) Thanks for supporting and for your videos. It's really helping a lot of people!

    • @bumblebity2902
      @bumblebity2902 3 роки тому

      @@LaravelDaily Sadly, it could be. Maybe company works with large scale projects where this pricinple is applied. Junior developers could be easily confused with advanced code structure.

  • @valencefredrick7495
    @valencefredrick7495 Рік тому

    You talked about considering what might change in the future when choosing to implement the SOLID Principles. Doesn't that Violate the YAGN Extreme Programming Principle?

  • @mistersimeeec
    @mistersimeeec 3 роки тому +1

    Would be interested to see more combining I and D. E.g. if you're separating your interface concerns as you did in your example, but the method typehinting actually requires the combination of those interfaces how would you approach that? Would you have to create another interface which implements the two ones we need and just typehint that? Cheers.

    • @LaravelDaily
      @LaravelDaily  3 роки тому

      Good question. I guess in that case, if the situation requires one or another class, it would not go into parameter anymore, bue would rather be resolved inside the function itself.

  • @davenegasn
    @davenegasn Рік тому +1

    Why in the Single responsibility principle you use a service to handle the create logic and not the model?, shouldn't a method inside the model be enough?

  • @belce1982
    @belce1982 2 роки тому

    Thanks as always!

  • @ZamirMubashir
    @ZamirMubashir Рік тому

    Thanks!!

  • @noli-timere-crede-tantum
    @noli-timere-crede-tantum Рік тому

    8:56 Wouldn't the better solution to adding that new parameter in only one of the classes be to inject that param via the class constructor? This would retain LSP, as well as O/C.

  • @zieddams
    @zieddams 3 роки тому +1

    thank you for this content

  • @barktwain
    @barktwain Рік тому

    I liked developing with sublime, but phpstorm is far better! :)

  • @TheMarcelitto
    @TheMarcelitto 2 роки тому

    Excelent! Thank you for all you videos, I'm learning a lot, i have a doubt when you typehint the return type of a function, that function must return something always, if returns null, an exception occurred, and sometimes that null value it's fine, how should I proceed in that case?

    • @LaravelDaily
      @LaravelDaily  2 роки тому +1

      You may specify a few types to return: type, null or exception

  • @bremg9185
    @bremg9185 2 роки тому

    Nice! But how many methods/resposabilities does that controller have?

  • @bebebeb6498
    @bebebeb6498 2 роки тому +1

    Thx 👍

  • @salahuddinayubi3906
    @salahuddinayubi3906 3 роки тому

    you are genius

  •  2 роки тому

    shouldn't ReportDownloadInterface extends ReportDataInterface intead of implementing both?

  • @phpcoding9282
    @phpcoding9282 3 роки тому +1

    I'm a bit confused ... under the I principle you replaced ReportInterface with ReportDataInterface and ReportDownloadInterface .... but then later in the D example you have ReportInterface $report - how does this work with the Data and Download interfaces you created in the previous section?
    Could I do ReportDataInterface AND ReportDownloadInterface $report ? Because the report must have the two methods getData() and download() to work in the controller. Hope that makes sense 👍

    • @LaravelDaily
      @LaravelDaily  3 роки тому +2

      That's a bit of misleading example, I agree. In real life, if you separate two interfaces, then likely you won't use those interfaces as dependency in methods at all.

    • @phpcoding9282
      @phpcoding9282 3 роки тому +2

      @@LaravelDaily Thanks, I do find sometimes with Solid I dig my self into a corner with it. More of an art than a set of rules maybe.

  • @PetarVasilevX
    @PetarVasilevX 2 роки тому

    I didn't quite understand the Liskov substitution principle. Like what exactly is the problem there? Any other examples?

  • @dfordemo981
    @dfordemo981 2 роки тому

    is there any package/class that can convert pdf into proper html/css,? i mean the pdf is resumes, and properly written documents only, and we want to convert them into html/css's? 😁

  • @kaisertushar7554
    @kaisertushar7554 3 роки тому

    Thanks for awesome courses. Do you have any plan making a course for Laravel Octane?

    • @LaravelDaily
      @LaravelDaily  3 роки тому +1

      No, I haven't used it myself, and not planning to.

  • @RizkheyG
    @RizkheyG 2 роки тому

    Up till now I always treat 1 module in 1 class(ex: for Creating, updating and deleting with bunch of private methods for everything else that shouldn't accessed from outside the class for example for repeating task inside the class) until my team ask me to implement single responsibility principle and I have to separate my single class to let's say 3-5 separated class.
    The problem is, how to make sure someone else(maybe new dev in my team), not accessing "the other class" that previously/originally a private method in my original class?

  • @romanperegudov2723
    @romanperegudov2723 2 роки тому

    In example when you use injected InvoceService in action you violation D principle:) because you used concrete class, not interface
    Based on my practice - we need to create interfaces in situations when we are planning to create several implementations. Most of my interfaces have only one implementation, so i decided not to create interfaces, and bind components in IOC container using inplementation name instead of interface name.

  • @jimishukurow2286
    @jimishukurow2286 2 роки тому

    Royal like from me. I use VScode.

  • @llBestBoyll
    @llBestBoyll 2 роки тому

    PHP ❤️💪🏼🔥🔥🔥

  • @fcolecumberri
    @fcolecumberri 3 роки тому

    Which pages would you recommend to search laravel jobs

  • @goichikawasoe163
    @goichikawasoe163 3 роки тому

    Excuse me, what would you recomend to use with laravel? Vue.js or react.js?

    • @LaravelDaily
      @LaravelDaily  3 роки тому

      Vue is much more popular, with more examples.

    • @goichikawasoe163
      @goichikawasoe163 3 роки тому

      @@LaravelDaily i see, thank you, ita just that im trying to update my knowledge in laravel, because last time i was using it with jquery, but in this days, thats way obsolete u.u, well now i know, thank you again :)

  • @abdulrehmandar8541
    @abdulrehmandar8541 3 роки тому

    Hi Povilas. I need suggestion. I'm using spatie media library for storing images. but how to give collection url to api user. How mobile app developer get media urls. Thank you

    • @LaravelDaily
      @LaravelDaily  3 роки тому

      Read the package documentation for it, I remember they do have Media Collections or something like that.

    • @abdulrehmandar8541
      @abdulrehmandar8541 3 роки тому

      @@LaravelDaily yes for web I can use media but for mobile app I don't think there's anything. I think I have to get get media my self and send it into response.

  • @MichaMarcak
    @MichaMarcak 3 роки тому

    Na twojej stronie z kursem SOLID piszesz " Want to get a Senior Laravel developer position?
    You probably need to master software design principles, like SOLID." .. Ale ja śledzę oferty pracy dla juniorów w których już trzeba znać i stosować zasady SOLID :( Źle myślę?

    • @doktoracula7017
      @doktoracula7017 3 роки тому +1

      W ofertach dla juniorów podaje się że wymagana znajomość SOLID, ale ostatecznie często nie trzeba ich za dobrze znać. Pamiętaj, że wymagania w ofertach nie muszą być spełnione na 100% żeby zostać zatrudnionym, szczególnie jeśli czymś innym się zaimponuje.

    • @MichaMarcak
      @MichaMarcak 3 роки тому

      @@doktoracula7017 Na razie nie udało mi się zaimponować rekruterom :( Ale cały czas się edukuje- czeka mnie refaktoring moich projektów na github- może wtedy to pomoże... i kolejna sprawa- chyba najgorsza dla mnie... język angielski - ale uczę się języka - może życia starczy :) hi hi
      Pozdrówka

  • @Ramziddin_Rustamovv
    @Ramziddin_Rustamovv 11 місяців тому

    😊

  • @yhaelopez
    @yhaelopez 3 роки тому

    8:00
    PhpStorm: Excuse me?

  • @claushellsing
    @claushellsing 3 роки тому +1

    Hate myself to ask, sorry to be that guy. But any coupon for early buyers ?

    • @LaravelDaily
      @LaravelDaily  3 роки тому +1

      Not for early buyers this time.
      But generally, you can get some discount on all my products, here: coupons.laraveldaily.com

  • @educationey9572
    @educationey9572 3 роки тому +1

    honestly, for people like who live in worst country in the world(iran) course's price is to high...
    it's basically salary of 1 months of work... :(
    I would like to take this course but it's to high to pay for 1-2~ hrs course.

    • @LaravelDaily
      @LaravelDaily  3 роки тому

      I can't give it away for free, but I can give some discount based on where you live:
      coupons.laraveldaily.com
      And this course could easily be longer, 5-6 hours, but I intentionally stripped it down to what you ACTUALLY need to know, without unnecessary stuff.

  • @bumblebity2902
    @bumblebity2902 3 роки тому

    Sadly, SOLID principles you should know applying for first job, unless you are pre-junior/intern. No matter what stack, it is mandatory to know.