Custom PHP OOP Router without PHP libraries

  Рет қаралды 38,017

Max Pronko

Max Pronko

Күн бұрын

Пікірлер: 65
@firstignitor
@firstignitor 2 жыл бұрын
From now on I can't forget the name Max. Max the PHP routing master.. thank you ..en like the voice - audible enough to make me understand.. thanks once more again
@MaxPronko
@MaxPronko 2 жыл бұрын
Thanks a lot for your feedback
@4rmboy
@4rmboy 11 ай бұрын
The most useful video demonstrating the MVC pattert in php that i watched so far.
@MaxPronko
@MaxPronko 7 ай бұрын
Thanks
@tusharnain6652
@tusharnain6652 6 ай бұрын
I am not gonna use any framework for my freelance projects, ever again. Thanks to you! ❤
@marshalldteach1109
@marshalldteach1109 2 жыл бұрын
I always use a framework because of routing but for my small projects, it's kind a overkill. So this is perfect for my next project. Thanks Max
@MaxPronko
@MaxPronko 2 жыл бұрын
Thanks for the feedback.
@MrJBisoy
@MrJBisoy 3 жыл бұрын
Can you add dynamic routing along with pattern match ??
@dieselkapasule4370
@dieselkapasule4370 2 жыл бұрын
Thanks a lot, Max, quite a helpful video.
@ersinbx1811
@ersinbx1811 Жыл бұрын
There is no index.php in the home directory, how does it work? I got stuck at 1:45. The requested resource / was not found on this server.
@MaxPronko
@MaxPronko Жыл бұрын
The index.php is located in the public folder, that is a document root
@ersinbx1811
@ersinbx1811 Жыл бұрын
@@MaxPronko thanks, cd public
@MrLinuxFreak
@MrLinuxFreak 3 жыл бұрын
great guide! can you do a guide about adding middlewares? particularly for validate requests values
@lorenzochukwuebukaobi8898
@lorenzochukwuebukaobi8898 3 жыл бұрын
Thank you so much for this video it was helpful. How do you add http headers using this routing system to prevent cors errors when building an API?
@NhatNguyen-xo9gs
@NhatNguyen-xo9gs 3 жыл бұрын
It is useful. Thank you for sharing
@MaxPronko
@MaxPronko 3 жыл бұрын
Thanks for watching!)
@andgoedu
@andgoedu 2 жыл бұрын
Thanks alot mate it actually works
@MaxPronko
@MaxPronko 2 жыл бұрын
Happy it works!!!
@entertainyou1855
@entertainyou1855 2 жыл бұрын
Can you share the source code used here
@kelolettek3927
@kelolettek3927 2 жыл бұрын
Hi how to include css file to phtml please I cant find
@luckydev3911
@luckydev3911 2 жыл бұрын
www.w3schools.com/Tags/tag_link.asp
@petrusmattiasdughem1899
@petrusmattiasdughem1899 Жыл бұрын
Hello can you use php built in webserver and connect to database?
@MaxPronko
@MaxPronko Жыл бұрын
Yes, why not?
@outerstring8747
@outerstring8747 3 жыл бұрын
awesome i would interested to see a whole MVC framework😍
@MaxPronko
@MaxPronko Жыл бұрын
Great idea
@catch_me_outside_how_bout_dat
@catch_me_outside_how_bout_dat 2 жыл бұрын
I am confused. How does the passing an array named params to a callback function associate the variable to the incoming request query params?
@lucassouzasilva6842
@lucassouzasilva6842 3 жыл бұрын
Hey this help me so much thanks
@grumpyjarl7336
@grumpyjarl7336 2 жыл бұрын
dude how can you handle scenario of items/{item-id} in this aproach ? thanx
@MaxPronko
@MaxPronko 2 жыл бұрын
Are you looking to add a parameter for a GET request?
@basisit3511
@basisit3511 3 жыл бұрын
Thanks, I´m currently learning the http_foundation and your lesson helped alot understanding how it works! thanks! BUT why? why do it like this? It gives us an object orientatet way of doing things, but it seems like a lot of hassle for doing it like this....... so why do it like this? is it more secure or?
@MaxPronko
@MaxPronko 3 жыл бұрын
What do you mean when asking your question?
@basisit3511
@basisit3511 3 жыл бұрын
@@MaxPronko :-) I dont understand why we should use http_foundation?
@PrakashPrakash-sn3do
@PrakashPrakash-sn3do 3 жыл бұрын
Awesome information Thank you so much
@MaxPronko
@MaxPronko 3 жыл бұрын
Thank you
@asifurrahman5436
@asifurrahman5436 2 жыл бұрын
Hey after implementing the router i am getting a database erro saying: "Database Error: could not find driver", please help me
@MaxPronko
@MaxPronko 2 жыл бұрын
Have you sorted the issue?
@zeeu
@zeeu 2 жыл бұрын
hello, I created a custom router like this, it works on php local server, but the problem is that it don't work on XAMPP and 000webhost, only the home page works
@MaxPronko
@MaxPronko 2 жыл бұрын
You should enable mod_rewrite module if you use Apache
@manishdeshpande
@manishdeshpande 3 жыл бұрын
Hi Max, Can you provide the link to the code in the video? Thanks much.
@fatkur
@fatkur 2 жыл бұрын
so cool dude!
@MaxPronko
@MaxPronko 2 жыл бұрын
Thanks
@faratanzaki
@faratanzaki 11 ай бұрын
Hi sir it's helpful for me because i even build a complete script with it, but i came to blog post part in which i was stuck on how to make it pass variable to the routher like that get(/post/{$id}, Post::class.'::index') but it is not working pls how would i implement it like that
@MaxPronko
@MaxPronko 11 ай бұрын
Let me record a video and explain
@faratanzaki
@faratanzaki 11 ай бұрын
@@MaxPronko ok Sir thanks we are waiting Sir
@trevorchristianamedayenou1982
@trevorchristianamedayenou1982 2 жыл бұрын
Hi Max Thank you very much for your tutorial. It has been really helpful for me. Instead of using Laravel which is a huge framework for just creating a simple website, your tutorial is indeed great. My question here is about twig, I would like to add twig in your tutorial but I kind of a bit lost. I would appreciate if you can give me some guidelines. Thanks!
@saifulbayan9597
@saifulbayan9597 3 жыл бұрын
Hi Max, Thanks for Great Video. I have some question about this router in php w/o libraries: 1. how to implement other http verb like PUT, PAtCH or DELETE to make the router restfull? 2. if i have some placeholder in Request URI param, how to replace it with some string i wanted. For example when i want make custom slug: $router->get('/post/{slug}, Post::class, postDetail($param)), and goal URI i wanted just like this /post/awesome-post. is possible to achieve that with that approach?
@MaxPronko
@MaxPronko Жыл бұрын
It is possible
@rssimran4800
@rssimran4800 2 жыл бұрын
Where is source code
@MaxPronko
@MaxPronko 2 жыл бұрын
It should be on my github mcspronko
@paulhetherington3854
@paulhetherington3854 Жыл бұрын
PHP' = Her personal productive! American Tribes
@iuseronline
@iuseronline 10 ай бұрын
Акцент шик))))
@MaxPronko
@MaxPronko 10 ай бұрын
Дякую👍
@ashmoore3709
@ashmoore3709 3 жыл бұрын
First :D
@ashmoore3709
@ashmoore3709 3 жыл бұрын
This is brilliant and very useful. Thanks again for all your hard work Max :)
@MaxPronko
@MaxPronko 3 жыл бұрын
Thanks Ash for the feedback. It means a lot to me.
@olezhonnv3215
@olezhonnv3215 3 жыл бұрын
Єврейський трохи роутер. Але більш-менш. Над вимовою попрацюй. Або веди канал на рідній мові.
@MaxPronko
@MaxPronko 3 жыл бұрын
Дивись канали на рідній мові, бо може щось не зрозуміло буде.
@giorgiobarone9784
@giorgiobarone9784 2 жыл бұрын
Hi nice work! I've followed all the video and I created a system as you taught. Some advice about passing parameters like users/$name/$surname ? Thanks
@MaxPronko
@MaxPronko 2 жыл бұрын
What use case do you want to achieve with name/surname?
@giorgiobarone9784
@giorgiobarone9784 2 жыл бұрын
@@MaxPronko hi, that is just an example. I said $name and $surname just as an example but I would have said $slug, $id... The use would be the same as codeigniter routing or laravel routing. I'm looking for more examples and I'm seeing it needs to use regex to interpreting signs like {$id}
@giorgiobarone9784
@giorgiobarone9784 2 жыл бұрын
@@MaxPronko Searching here and there, I tried to modify the code in this way, I paste here just the foreach inside the route method. There is always something wrong, can you give me some tips? Thank you! foreach($handlers as $handler): $params_values = []; $params_keys = []; preg_match_all("/(?
@faratanzaki
@faratanzaki 11 ай бұрын
like this one : $router->get('/contact/{$id}', function($param){ echo $param; });
@khaledeladawe7769
@khaledeladawe7769 2 жыл бұрын
call_user_func_array($callback, [ array_merge($_GET, $_POST) ]); it's not working I have this error: GET /about - Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, no array or stri ng given
@MaxPronko
@MaxPronko 2 жыл бұрын
It looks like your callback wasn’t setup properly, please check the code before this call.
PHP For Beginners, Ep 15 - Make a PHP Router
18:03
Laracasts
Рет қаралды 61 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
Create a Custom PHP MVC Framework in Just 1 Hour | Intermediate
45:55
Coding with Pixel Fix
Рет қаралды 2,4 М.
Simple Routing with PHP | Functional Programming
4:36
Max Pronko
Рет қаралды 21 М.
PHP For Beginners, Ep 33 - Build a Better PHP Router
20:46
Laracasts
Рет қаралды 24 М.
Is this the best PHP Routing library?
16:17
Coders Page
Рет қаралды 20 М.
Apache Kafka Crash Course
1:18:06
Hussein Nasser
Рет қаралды 441 М.
When to use Traits, Interfaces, and Abstract Classes in PHP
15:08
Andrew Schmelyun
Рет қаралды 24 М.
Express.js Middleware, Router, & Body-Parser
35:49
SimpleCodeCraft
Рет қаралды 125
PHP FOR BEGINNERS #3 - Create a simple Router
6:48
Alessandro “Alecaddd” Castellani
Рет қаралды 8 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН