PHP For Beginners, Ep 39 - Write Your First Middleware

  Рет қаралды 20,926

Laracasts

Laracasts

Жыл бұрын

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.com.
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 Жыл бұрын
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 Жыл бұрын
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.
@koller18
@koller18 10 ай бұрын
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 💖
@oheneadjei9832
@oheneadjei9832 Жыл бұрын
Can wait....I’m loving this tutorial from Jeff..
@RazvanIacob
@RazvanIacob Жыл бұрын
I like the longer form videos. Thank you for another good video!
@md.anwarhossain1179
@md.anwarhossain1179 Жыл бұрын
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 ❤
@Razor2k3
@Razor2k3 Жыл бұрын
I am eagerly waiting for the next videos in the series!
@hotwings9382
@hotwings9382 Жыл бұрын
I hope you didnt give up, i am waiting for the next steps.
@asheaven1st
@asheaven1st Жыл бұрын
Can't thank enough for this lesson.
@patricktrivino4770
@patricktrivino4770 Жыл бұрын
great video! it clearly explains the topic.
@MasroorHaider-dk2ch
@MasroorHaider-dk2ch Жыл бұрын
Guys more videos are on their website, link is in description
@jakubfrei3757
@jakubfrei3757 Жыл бұрын
Thx :)
@hilalahmad4736
@hilalahmad4736 Жыл бұрын
Awesome series 👍. Kindly create a video on phpstorm and customization
@niceKamrul
@niceKamrul 11 ай бұрын
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.
@lserranoit
@lserranoit Жыл бұрын
It would be awsome, another video with php units tests
@teamaccount9320
@teamaccount9320 Жыл бұрын
Love the lesson
@eduardogomez4676
@eduardogomez4676 Жыл бұрын
Fantastic video thanks a lot
@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 Жыл бұрын
Can we translate this video langauge from English to hindi
@AtomTCP
@AtomTCP Жыл бұрын
finally please implement middleware system in your router
@opionetics
@opionetics Жыл бұрын
Awesome series, just wondering if more episodes are coming out or is the end of the series ?
@niceKamrul
@niceKamrul Жыл бұрын
No ChatGPT can deliver a course like this. We need him continue. Let us cheer him up!
@bulent2435
@bulent2435 Жыл бұрын
nice one. thanks.
@pratikbhujel
@pratikbhujel Жыл бұрын
Is this the last one ?
@JACKoPL
@JACKoPL Жыл бұрын
This is last free video? Laracast Ep40 for subs...
@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 )
@Doomw1ngs
@Doomw1ngs Жыл бұрын
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?
@swancompany_inc
@swancompany_inc Жыл бұрын
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.
@user-hk2sl5ut7n
@user-hk2sl5ut7n Жыл бұрын
very good series, will it continue?
@mexantos
@mexantos 11 ай бұрын
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
@ihorrud5088
@ihorrud5088 Жыл бұрын
Awesome
@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.
@alexanderrobinson5570
@alexanderrobinson5570 Жыл бұрын
Check out Programing with Gio
@alexanderrobinson5570
@alexanderrobinson5570 Жыл бұрын
kzbin.info/aero/PLr3d3QYzkw2xabQRUpcZ_IBk9W50M9pe-
@soldierbirb
@soldierbirb 3 ай бұрын
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)
@socialoutcast5387
@socialoutcast5387 10 ай бұрын
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.
@alanfaruq4854
@alanfaruq4854 Жыл бұрын
thanks bro
@lahoucineoldakdim7778
@lahoucineoldakdim7778 Жыл бұрын
Can you refactor the code to implementing PSR-7 interfaces for HTTP requests and responses.
@MuhammadFaisal-sb9yl
@MuhammadFaisal-sb9yl 9 ай бұрын
Great
@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
@vincentbeaulieu7553
@vincentbeaulieu7553 Жыл бұрын
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 Жыл бұрын
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 10 ай бұрын
@@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())`.
@jeremyframirezpasapera596
@jeremyframirezpasapera596 9 ай бұрын
Hello, if I wanted the controllers to be a class, what would be the best way to do it?
@whatamiwitnessing1003
@whatamiwitnessing1003 9 ай бұрын
What php version does this series target?
@KgfLikia
@KgfLikia Жыл бұрын
Building something like laravel, slowly :P
@howuseehim
@howuseehim 10 ай бұрын
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
@galihanggorojati3455
@galihanggorojati3455 Жыл бұрын
Hi Jeffrey, what editor theme you are using?
@lserranoit
@lserranoit Жыл бұрын
Hey Jeffrey, I want to support you with Spanish Subtitles.
@mpavankumar6695
@mpavankumar6695 Жыл бұрын
what is your editor's font family
@jediampm
@jediampm 11 ай бұрын
Hi, any news when we will get a new video ???? thanks
@amanchaudhary101
@amanchaudhary101 Жыл бұрын
can I get the source code of this project?, that would help me
@toanquoc506
@toanquoc506 Жыл бұрын
What PHP IDE are you using? thank
@Laracastsofficial
@Laracastsofficial Жыл бұрын
PHPStorm.
@kansermusika2456
@kansermusika2456 Жыл бұрын
waiting for EPS 40...:
@user-so5he3op1q
@user-so5he3op1q Жыл бұрын
I think this is too advanced for a beginner
PHP For Beginners, Ep 35 - Make Your First Service Container
19:23
OMG🤪 #tiktok #shorts #potapova_blog
00:50
Potapova_blog
Рет қаралды 17 МЛН
Пробую самое сладкое вещество во Вселенной
00:41
PHP on the frontend! No more Javascript!
14:47
Aaron Francis
Рет қаралды 118 М.
PHP For Beginners, Ep 37 - Sessions 101
13:57
Laracasts
Рет қаралды 12 М.
Getting started with htmx
6:33
php[architect]
Рет қаралды 1,3 М.
How Middleware Works
20:23
Codecourse
Рет қаралды 13 М.
What is Middleware?
10:11
IBM Technology
Рет қаралды 88 М.
#[Override] attribute is coming to PHP 8.3
2:08
Nuno Maduro
Рет қаралды 2,7 М.
PHP For Beginners, Ep 50 - The Next Step in Your Php Journey
16:28
Why didn't the Angular team just use RxJS instead of Signals?
8:15
Joshua Morony
Рет қаралды 87 М.
PHP For Beginners, Ep 30 - Autoloading and Extraction
19:37
Laracasts
Рет қаралды 14 М.
PHP is the future
34:27
Aaron Francis
Рет қаралды 168 М.