PHP For Beginners, Ep 39 - Write Your First Middleware

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024
  • In this episode, we'll discuss the concept of middleware, and how it can be used as a bridge between an incoming request and the core of your application. We'll create two middleware classes to handle route authorization for guests and authenticated users. Watch this full series at phpforbeginners....
    Watch thousands of videos, track your progress, and participate in a massive Laravel community at Laracasts.com.
    Laracasts: laracasts.com
    Laracasts Twitter: / laracasts
    Jeffrey Way Twitter: / jeffrey_way

Комментарии • 63

  • @belalehner3937
    @belalehner3937 Год назад +11

    This series is getting better and better with every episode. As someone hasn't noticed. JW let You learn the basic logic and techniques behind the very popular Laravel framework. It's very much worth to work with him and write the code (or maybe improve it) by your own, it's for your own benefit... And a short remark on the naming of the series: it's much more advanced than beginner level, but it's not a problem at all!

  • @prestonkhumbula1219
    @prestonkhumbula1219 Год назад +6

    Hi Jeffrey, I hope you will see this. First I would like to express my heartfelt gratitude for the priceless contribution you have made to my programming career. I used the PHP for beginners series and I got a distinction in the exams. I once tried Laravel last year on some other channel tutorial but it quickly confused me and I quit. Today, I have completed the Laravel 5.4 series and I am moving to the next Laravel series. Words will never be enough to thank you. You have made more impact than you can even imagine..All the love from Africa, Zimbabwe to be specific.

  • @md.anwarhossain1179
    @md.anwarhossain1179 Год назад +3

    Dear Jeffrey,
    This series is really very very helpful.
    I requested to you please describe about
    01. Model and
    02. Create a controller NoteController.php
    Finally, many many thanks for this series ❤

  • @koller18
    @koller18 Год назад +1

    Jeffrey, we hope you are doing well and just decided to take a vacation or important business came up. All the best to you, thousands of people are waiting for your return! From Russia with love 💖

  • @MasroorHaider-dk2ch
    @MasroorHaider-dk2ch Год назад +1

    Guys more videos are on their website, link is in description

  • @Kamrul_abc
    @Kamrul_abc Год назад

    I have seen your tweet on your new phpstorm course on laracast. Now, that must be great. But, we are eagerly waiting for this wonderful php course of yours. So, this is probably high time for you to concentrate on finishing this course again - if possible.

  • @hotwings9382
    @hotwings9382 Год назад +1

    I hope you didnt give up, i am waiting for the next steps.

  • @opionetics
    @opionetics Год назад +3

    Awesome series, just wondering if more episodes are coming out or is the end of the series ?

    • @Kamrul_abc
      @Kamrul_abc Год назад +1

      No ChatGPT can deliver a course like this. We need him continue. Let us cheer him up!

  • @RazvanIacob
    @RazvanIacob Год назад +1

    I like the longer form videos. Thank you for another good video!

  • @Razor2k3
    @Razor2k3 Год назад

    I am eagerly waiting for the next videos in the series!

  • @pratikbhujel
    @pratikbhujel Год назад +2

    Is this the last one ?

  • @lserranoit
    @lserranoit Год назад +1

    It would be awsome, another video with php units tests

  • @JACKoPL
    @JACKoPL Год назад +2

    This is last free video? Laracast Ep40 for subs...

  • @oheneadjei9832
    @oheneadjei9832 Год назад

    Can wait....I’m loving this tutorial from Jeff..

  • @socialoutcast5387
    @socialoutcast5387 Год назад +1

    Hi, Jeffrey it's been over 4 months that you haven't uploaded any video in this series please try to be consistent with this series because its my only source of learning programming and thank you for the great work.

  • @asheaven1st
    @asheaven1st Год назад +1

    Can't thank enough for this lesson.

  • @AtomTCP
    @AtomTCP Год назад +1

    finally please implement middleware system in your router

  • @hilalahmad4736
    @hilalahmad4736 Год назад

    Awesome series 👍. Kindly create a video on phpstorm and customization

  • @Doomw1ngs
    @Doomw1ngs Год назад +1

    I'm considering to join your company and start learning about Laravel because I think is powerful tool to do anything. Can I ask you because I saw the "path section" on your site which is amazing btw, if something change on technology and the lectures for example "PHP for beginner " does not working as it used to be, do you update them frequently?

  • @user-du6ns4ww6o
    @user-du6ns4ww6o Год назад

    Wow, my respect, absolutely useful, I have an idea to translate your lessons into my language and we can help a bunch of people to understand php.

    • @devgaming4045
      @devgaming4045 Год назад +1

      Can we translate this video langauge from English to hindi

  • @user-hk2sl5ut7n
    @user-hk2sl5ut7n Год назад

    very good series, will it continue?

  • @braintricker_soft
    @braintricker_soft Год назад

    why i didn't I find this type of content when I learned PHP 6-7 years ago .. Thanks, Jeffery

    • @TheRafark
      @TheRafark Год назад

      Where did you learn php 6?

    • @braintricker_soft
      @braintricker_soft Год назад

      @@TheRafark i did not mention php 6 any where i wrote 6-7 years (a period )

  • @swancompany_inc
    @swancompany_inc Год назад +1

    Thanks for the video Jeffery! Had a question about screencasts in general. Have you ever tried recording a down view of your keyboard? So people can see how you work the keyboard and mouse? Wonder if that would add any value or just cause distraction. Just a thought.

    • @edewaal97
      @edewaal97 Год назад

      I know the software called Camtasia incorporates key presses or shortcut keys. That would be nice to show how he moves between files with his keyboard, or uses it to go to a line in the code for example. I get that's not what this course is about, but these are nice things to know. Maybe something for another series? "How to navigate quickly in phpstorm"
      But than these videos will come out slower than they already get released. I'm impatiently waiting after every one for the next.

  • @soldierbirb
    @soldierbirb 5 месяцев назад

    Could the "middleware not found" case, where you throw an Exception, be handled using an Enum? The error would be caught at the editor level (within the language server)

  • @patricktrivino4770
    @patricktrivino4770 Год назад

    great video!
    it clearly explains the topic.

  • @whatamiwitnessing1003
    @whatamiwitnessing1003 11 месяцев назад

    What php version does this series target?

  • @jeremyframirezpasapera596
    @jeremyframirezpasapera596 Год назад

    Hello, if I wanted the controllers to be a class, what would be the best way to do it?

  • @lahoucineoldakdim7778
    @lahoucineoldakdim7778 Год назад +1

    Can you refactor the code to implementing
    PSR-7 interfaces for HTTP requests and responses.

  • @socialoutcast5387
    @socialoutcast5387 Год назад

    Hi, Jeffrey it's been over 2 weeks that you haven't uploaded any video in this series please try to be consistent with this series because its my only source of learning programmning and thank you for the great work.

  • @eduardogomez4676
    @eduardogomez4676 Год назад

    Fantastic video thanks a lot

  • @vincentbeaulieu7553
    @vincentbeaulieu7553 Год назад +1

    What are the advantages of using the key in the route file? Can't I just use `only->(Auth::class)` in the router file directly ? Is it to verify that the middleware exist? can we do that using my technique also? Thanks for these videos !

    • @Sunil-kq9bx
      @Sunil-kq9bx Год назад +2

      Yes you can do it the way you described. No it is not to verify if the middleware exists. Doing it with a keyword requires the map. Your way would not require to check if the key refers to a class. But you might wanna check if the class being passed to the only method is a middleware. You could make a MiddlewareInterface and have every middleware implement that and cast the parameter from the only method to the MiddlewareInterface. If you than rename $key to $middleware and cast it to be either null or MiddlewareInterface in the resolve method from the Middleware class you could also skip the if check to throw an exception if the middleware is not found (in your case invalid class).

    • @jhnsmllr
      @jhnsmllr Год назад

      @@Sunil-kq9bx Yes better is to create the MiddlewareInterface and simply implement `public function middleware(MiddlewareInterface $middleware): void` Method in the Router.php. Then use it on `routes.php` with `$router->get(...)->middleware(new MyMiddleware())`.

  • @mexantos
    @mexantos Год назад

    If there any of your videos explain about hook, event or whatever you call it in the PHP atmosphere, and how to do it just like of this middleware or router on your video, with simple php ways not with frameworks, so we know how it works and got better knowledge about that

  • @mpavankumar6695
    @mpavankumar6695 Год назад +1

    what is your editor's font family

  • @galihanggorojati3455
    @galihanggorojati3455 Год назад

    Hi Jeffrey, what editor theme you are using?

  • @teamaccount9320
    @teamaccount9320 Год назад

    Love the lesson

  • @MuhammadFaisal-sb9yl
    @MuhammadFaisal-sb9yl 11 месяцев назад

    Great

  • @jediampm
    @jediampm Год назад

    Hi, any news when we will get a new video ???? thanks

  • @olaitanmichaelolanrewaju9122
    @olaitanmichaelolanrewaju9122 Год назад

    I find it hard to use my custom css styling
    Cus I don't want to use and css frameworks
    How can i go about that?
    Thanks for the tutorial

  • @bulent2435
    @bulent2435 Год назад

    nice one. thanks.

  • @howuseehim
    @howuseehim Год назад +1

    Wow, it's over, after everything...

  • @martinsluters3651
    @martinsluters3651 Год назад

    Thank you for the episode! Would it be correct to say that within Core\Middleware\Middleware class you used static factory pattern to instantiate a concrete middleware?

    • @ihorchyshkala6325
      @ihorchyshkala6325 Год назад

      Short answer is 'no'

    • @martinsluters3651
      @martinsluters3651 Год назад

      ​@@ihorchyshkala6325 thanks. Is it mainly because Core\Middleware\Middleware does not return the instantiated object? A factory should return an object, right?

    • @Sunil-kq9bx
      @Sunil-kq9bx Год назад

      ​@@martinsluters3651 correct, it is not a factory because it never returns an object. A factory ussually returns an object, altough it is not common practice there are cases where a factory can return null

  • @toanquoc506
    @toanquoc506 Год назад

    What PHP IDE are you using? thank

  • @KgfLikia
    @KgfLikia Год назад

    Building something like laravel, slowly :P

  • @ihorrud5088
    @ihorrud5088 Год назад

    Awesome

  • @alanfaruq4854
    @alanfaruq4854 Год назад

    thanks bro

  • @amanchaudhary101
    @amanchaudhary101 Год назад

    can I get the source code of this project?, that would help me

  • @lserranoit
    @lserranoit Год назад

    Hey Jeffrey, I want to support you with Spanish Subtitles.

  • @kansermusika2456
    @kansermusika2456 Год назад

    waiting for EPS 40...:

  • @user-so5he3op1q
    @user-so5he3op1q Год назад

    I think this is too advanced for a beginner