Within the first 2 minutes I can already say this is some very high quality content, straight to the point. But the music is wildly distracting. I wish there was a version without the music
I saw several php framework from scratch videos like this and so far only this one and from the laracast channel have the most professional way to do it. Others are still doing the old ways where the URI segments are broken down to controller, method, params, etc which are not bad for a beginner but not for real world web apps. This is the way it should be done. Thanks for the video. Saved it to my playlist to keep as refresher.
Finally I found more modern and professional material about my own mvc/framework. From what I see, it doesn't take much to adapt routes like in laravel / Route::get() /. Nevertheless, it would be useful to have material about the view for this framework like Blade and Eloquent :D Maybe there will be another film after 18 months.
Hi Gary, at timestamp 44:23, you are using "REQUEST_URI". I found that there are instances where this parameter may not be available. How is that handled?
Good question...the handler might not be a controller object, later on I also make it possible to use an inline function in the web.php file. In addition to that, I later also use the container to resolve and autowire controllers...but spreading would still work with that. A lot of answers come later as the course progresses
Thank you for the detailed video. The approach is truly modern and not the standard MVC crab that one usually finds on UA-cam. I will purchase the course to incorporate your explanations of the code. Are you planning to write a router completely from scratch in the future and make a video about it?
You're welcome..I'm sure you'll enjoy the full course. Creating a production grade router from scratch is a pretty tall order...I'd have to think about it. Even the ones that you think have been build from scratch use Fastroute under the hood.
What's the performance difference between running this kernel/router in PHP versus just having your routes in .htaccess? Is there a point in which the request is handled faster in one or the other?
I don't know about performance but the php router is used to direct the request to the appropriate request handler...which is also php code. It would only be possible to do that using .htaccess by directing to different php files (I think)..which means you'd lose your single point of entry, amongst other things
It's great..I'm using it in PHP API Pro (www.garyclarke.tech/p/php-api-pro) Highly recommended to anyone learning because it helps you get a good understanding of PSR and all the framework components because it's much smaller and lighter then behemoths like Symfony and Laravel Give it a try!
Hello Gary. In the minute 46:00 you create this structure that is like an array but reverted: [$status, $handler, $vars] = $routeInfo; What is the name of this structure? I've searched "assign array to variable" but nothing is shown. Can you (or someone) point me to the right direction please? Thank you.
Hi Gary, the code at timestamp 1:11:07 should not work as the call_user_func_array is passing an array but the show method is still typed as int. I am getting the same error. Additionally, $vars contains a string for "id" and not an int.
It should still work like mine. The $vars array contains the same number of items as the method signature so they will just be mapped. Also PHP will try to cast strings to ints if an int is type-hinted by the method...this will work if the string can be cast to an int i.e. it is a string containing whole numbers only.
@@GaryClarkeTech Yes i declared strict types in all my scripts. I removed it and it worked fine but do not feel good about it. The regex declared as digits but what is transmitted is string. I guess that how http get works. Thank you for clarifying.
@@truthteachers Cool..glad you got it working. Personally I think it's fine to relax on the strict types declaration in controllers cos it's very common to receive data in string format that you wish to cast to ints. It's all a trade-off! Controllers are a fairly unique part of the puzzle
I'm gonna say either your php version..that might be unlikely though cos v2 just requires 7.4 or it could be your minimum-stability setting. By default this will be stable unless specified otherwise in your composer.json. To use the dev-master of fastroute your minimum-stability would need to be dev Just check my setting in the repo to see how your compare: github.com/GaryClarke/php-framework-pro
Yes, you can but I'd recommend swapping the Request / Response classes for Symfony HttpFoundation ones...that's why I used the same public API...easy substitution. I'll include some recommendations at the end of the full course for production use.
@@atomeksss DB will be agnostic, using a DB abstraction layer, auth yes, registration likely, email..dunno, recaptcha don't think so ..other priorities. Good suggestions
@@GaryClarkeTech Thanks for the reply. Today I realised of more important things. Like title, meta-description, breadcrumbs and how to output some alert.. Like, 'thank you for your registration' message. Ofc you can simply redirect user to another page, but you're not going to redirect users after every form submit on site... Sometimes you just wanna add a message below breadcrumbs. Anyways, thanks for the knowledge and will be waiting for the course! Yes, registration can be just a few words about... Maybe it's not necessary to show exactly how it's done.
Actually, two more topics for your consideration: views (but I think you'll cover that... Also all these things like title, meta-description, breadcrumbs and how to output some alert are in the view topic if I'm correct) and file uploads, thanks!
thanks for this but you lost me a little bit when introcing the rooter because you use the already built Fst routing component and i did not understand how rooting works... anyway of you can do everything fro, scrash the should be good to understand
I used FastRoute mainly for its handling of regex and splitting of paths. I still needed to do some work to match those paths to handlers so that's why I created my router class. The league/route library also does this as FastRoute alone does not suffice
Question: is there a difference between the $kernel and the middleware? Since the $kernel handles incoming requests as the middleware is supposed to do.
Thanks for great tutotial. It would be nice if you added Models and templating such as blade or twig to be complete MVC framework. I hope you will add this later.
I've recreated some of my fave parts from both. There are occasions where I prefer how one framework handles things. I also consider which way of doing things would be the easiest to teach.
Hi Gary, nice job. In the description you gave us the link for the full course but when i clicked the link i just got into you website but not the full course. Advise please. Additionally, many of us dont like using additional components/tools like Docker. We would like to stick to basics that way Docker can die for all we care. We want to use XAMPP because that deployment to CPanel will be straight forward.
Cheers Mani..the link for the full course is here: www.garyclarke.tech/p/php-framework-pro I used Docker here because I only have to share one file with you and you run one command and have the same setup as me on any operating system. But if you have a setup that you are comfortable with then defo stick with that. Your commands will be the same, minus docker compose exec app
@@GaryClarkeTech Hi Gary, The link still does not provide the full course. All it does is show description and codes in text form. there is no videos there. Is that what it is meant to be? Tq for the advise on Docker. I figured out that too. The only thing is the image part. Do do not understand that.
@@truthteachers The full course will be released in March and you'll be able to enroll on that same page. There are some sample videos at the bottom and I'll add some more there in a few days.
Within the first 2 minutes I can already say this is some very high quality content, straight to the point. But the music is wildly distracting. I wish there was a version without the music
Yeah the music was a mistake! I actually removed it for the full course cos someone else also said it sucked 😂
I saw several php framework from scratch videos like this and so far only this one and from the laracast channel have the most professional way to do it. Others are still doing the old ways where the URI segments are broken down to controller, method, params, etc which are not bad for a beginner but not for real world web apps. This is the way it should be done. Thanks for the video. Saved it to my playlist to keep as refresher.
your right
Frankly speaking this video needs millions of views.
Ah thanks a lot...I appreciate the kind words!
A great content you have here. THis is worth hundreds of dollars. Thanks a lot Gary
Finally I found more modern and professional material about my own mvc/framework. From what I see, it doesn't take much to adapt routes like in laravel / Route::get() /. Nevertheless, it would be useful to have material about the view for this framework like Blade and Eloquent :D Maybe there will be another film after 18 months.
Hi Gary, at timestamp 44:23, you are using "REQUEST_URI". I found that there are instances where this parameter may not be available. How is that handled?
So happy i found this channel today
Welcome aboard!
Thank you sir, following you on X @@GaryClarkeTech
Thanks Gary. I always enjoy your talks and examples.
Glad you like them!
1:09:00 - Why not just spreading the $vars as parameter of the controller method? "(new $controller())->$method(...$vars)"
Good question...the handler might not be a controller object, later on I also make it possible to use an inline function in the web.php file.
In addition to that, I later also use the container to resolve and autowire controllers...but spreading would still work with that.
A lot of answers come later as the course progresses
@@GaryClarkeTech Looking forward for May 2nd!
Starting to watch this but was wondering if the course on the site gets updated. Was thinking of buying it and wanted to make sure things are updated.
Yep..all my courses receive updates after release
Thank you for the detailed video. The approach is truly modern and not the standard MVC crab that one usually finds on UA-cam. I will purchase the course to incorporate your explanations of the code. Are you planning to write a router completely from scratch in the future and make a video about it?
You're welcome..I'm sure you'll enjoy the full course. Creating a production grade router from scratch is a pretty tall order...I'd have to think about it. Even the ones that you think have been build from scratch use Fastroute under the hood.
Great content very clear and has helped me better understand the inner workings of PHP framework! I am now off to learn CakePHP
Glad it was helpful!
What's the performance difference between running this kernel/router in PHP versus just having your routes in .htaccess? Is there a point in which the request is handled faster in one or the other?
I don't know about performance but the php router is used to direct the request to the appropriate request handler...which is also php code. It would only be possible to do that using .htaccess by directing to different php files (I think)..which means you'd lose your single point of entry, amongst other things
@@GaryClarkeTech I have implemented a new php router since watching this video and I see zero issues with performance.
Hey Gary!, what is your opinion about a framework named "Slim Framework"? Is this somenthing related to what you explain in this list of videos?
It's great..I'm using it in PHP API Pro (www.garyclarke.tech/p/php-api-pro)
Highly recommended to anyone learning because it helps you get a good understanding of PSR and all the framework components because it's much smaller and lighter then behemoths like Symfony and Laravel
Give it a try!
Hello Gary.
In the minute 46:00 you create this structure that is like an array but reverted:
[$status, $handler, $vars] = $routeInfo;
What is the name of this structure?
I've searched "assign array to variable" but nothing is shown.
Can you (or someone) point me to the right direction please?
Thank you.
This is called array destructuring...or list unpacking if you're old skool
Thanks a lot Mr. Gary, is more clear now 💪🏻
I love your this short mvc framework tutorial. Want to learn more from your framework course. Can you publish that mvc framework course in udemy?
I don't use Udemy but you can find the full course at my site:
www.garyclarke.tech/p/php-framework-pro
Hi Gary, the code at timestamp 1:11:07 should not work as the call_user_func_array is passing an array but the show method is still typed as int. I am getting the same error. Additionally, $vars contains a string for "id" and not an int.
It should still work like mine. The $vars array contains the same number of items as the method signature so they will just be mapped. Also PHP will try to cast strings to ints if an int is type-hinted by the method...this will work if the string can be cast to an int i.e. it is a string containing whole numbers only.
Having thought about it, could it be possible that you're declaring strict types somewhere where I'm not?
@@GaryClarkeTech Yes i declared strict types in all my scripts. I removed it and it worked fine but do not feel good about it. The regex declared as digits but what is transmitted is string. I guess that how http get works. Thank you for clarifying.
@@truthteachers Cool..glad you got it working. Personally I think it's fine to relax on the strict types declaration in controllers cos it's very common to receive data in string format that you wish to cast to ints. It's all a trade-off! Controllers are a fairly unique part of the puzzle
Bought your full course. Thank you for the discount coupon.👍
Hello, I am having problems purchasing your course. Is it still available?
Specifically, I have a problem with the payment gateway.
Email info@garyclarke.tech and we'll try to help ya
I'm from Russia. Thanks for video!
Thanks for watching!
It's great Gary
Can you please implement Middleware, Authentication and Authorization.
Bunch of thanks
Yes that's all included in the full course
www.garyclarke.tech/p/php-framework-pro
is this works only with docker? or not?
It works with anything. Using my Docker setup is just a recommendation..it means the student will have the same setup as me.
Hi Gary, when i install FastRoute it installs Version 1.3 and not 2.0. Is there something wrong?
I'm gonna say either your php version..that might be unlikely though cos v2 just requires 7.4 or it could be your minimum-stability setting. By default this will be stable unless specified otherwise in your composer.json. To use the dev-master of fastroute your minimum-stability would need to be dev
Just check my setting in the repo to see how your compare:
github.com/GaryClarke/php-framework-pro
@@GaryClarkeTech Yep, got it. Thank you so much. Just a note that github code does not appear to be for this video course
FastRoute simpleDispatcher is deprecated and the documentation doesn't have any other method to use in its place that isn't deprecated.
Yes..very strange. Just use version 1.3 to work along with this.
Great, beautiful work🤓
Thank you! 😊
Thanks for your time we appreciate it
My pleasure...thanks for watching
Hi Gary, what software are you using? is there anything specific which is needed? cheers :-)
Just PHP and an editor / IDE is all you need
Thank you for this very important video.
You're welcome..thanks for watching
Great work !! waiting for next videos !!
What about support middleware how to implement into Router!!!
That's done in the full course. An entire chapter on middleware in fact
Thanks, awesome work, can I use this framework for production?
Yes, you can but I'd recommend swapping the Request / Response classes for Symfony HttpFoundation ones...that's why I used the same public API...easy substitution.
I'll include some recommendations at the end of the full course for production use.
Hi, maybe you'll add some examples on how to use MySQL db, user authentication, registration, maybe some email sending, reCAPTCHA with this framework?
@@atomeksss DB will be agnostic, using a DB abstraction layer, auth yes, registration likely, email..dunno, recaptcha don't think so ..other priorities. Good suggestions
@@GaryClarkeTech Thanks for the reply. Today I realised of more important things. Like title, meta-description, breadcrumbs and how to output some alert.. Like, 'thank you for your registration' message. Ofc you can simply redirect user to another page, but you're not going to redirect users after every form submit on site... Sometimes you just wanna add a message below breadcrumbs. Anyways, thanks for the knowledge and will be waiting for the course! Yes, registration can be just a few words about... Maybe it's not necessary to show exactly how it's done.
Actually, two more topics for your consideration: views (but I think you'll cover that... Also all these things like title, meta-description, breadcrumbs and how to output some alert are in the view topic if I'm correct) and file uploads, thanks!
How can I get a coupon for this course ?
I do discounts for subscribers. There are sign up boxes on the course page
www.garyclarke.tech/p/php-framework-pro
thanks for this but you lost me a little bit when introcing the rooter because you use the already built Fst routing component and i did not understand how rooting works... anyway of you can do everything fro, scrash the should be good to understand
I used FastRoute mainly for its handling of regex and splitting of paths. I still needed to do some work to match those paths to handlers so that's why I created my router class. The league/route library also does this as FastRoute alone does not suffice
how to return a file like the view in laravel
Templates is covered later in the course
Interesting tutorial, thanks for all.
You are welcome!
Thank you for your lessons. How can I contact you to ask questions about the course?
Thanks for watching.
You can email info@garyclarke.tech or message me on Twitter / LinkedIn
Excellent !
Great video! Thanks so much!
Welcome...thanks for watching!
Great work. Thank you sir
You are welcome..thanks for watching!
Nice course
amazing !!!!! Thank you very much
Thanks for watching!
I would buy but it's a bit expensive
My mailing list subscribers get discounts
Excelente
great work
Thank you! 😊
You rock!
Cheers buddy..you rock too!
Thank you very much! Appreciate a lot your hard work!
Thanks for watching!
Add middlewares
Added in the full course
Question: is there a difference between the $kernel and the middleware? Since the $kernel handles incoming requests as the middleware is supposed to do.
Thanks for great tutotial. It would be nice if you added Models and templating such as blade or twig to be complete MVC framework. I hope you will add this later.
Yes both of those get added. I build a complete framework...you can check the contents here:
www.garyclarke.tech/p/php-framework-pro
@@GaryClarkeTech great thanks )
thanks you siiiiir
You're welcome..thanks for watching
lol just realised its PhpStorm :-)
Subbs!!! to the channel BTW
Looks like the course may be more aligned to symfony framework which is used by Laravel as well.
I've recreated some of my fave parts from both. There are occasions where I prefer how one framework handles things. I also consider which way of doing things would be the easiest to teach.
Hi Gary, nice job. In the description you gave us the link for the full course but when i clicked the link i just got into you website but not the full course. Advise please. Additionally, many of us dont like using additional components/tools like Docker. We would like to stick to basics that way Docker can die for all we care. We want to use XAMPP because that deployment to CPanel will be straight forward.
Cheers Mani..the link for the full course is here: www.garyclarke.tech/p/php-framework-pro
I used Docker here because I only have to share one file with you and you run one command and have the same setup as me on any operating system. But if you have a setup that you are comfortable with then defo stick with that. Your commands will be the same, minus docker compose exec app
@@GaryClarkeTech Hi Gary, The link still does not provide the full course. All it does is show description and codes in text form. there is no videos there. Is that what it is meant to be?
Tq for the advise on Docker. I figured out that too. The only thing is the image part. Do do not understand that.
@@truthteachers The full course will be released in March and you'll be able to enroll on that same page. There are some sample videos at the bottom and I'll add some more there in a few days.
@@GaryClarkeTech Thank you so much.💗