Custom PHP OOP Router without PHP libraries

Custom PHP OOP Router without PHP libraries

Max Pronko

3 года назад

36,424 Просмотров

This PHP routing is the simplest and easy-to-implement routing system in PHP. The routing is based on the Apache .htaccess file and uses an Apache Rewrite module.

Learn PHP and Magento 2 at the https://magemastery.net

Build User Login with PHP and MySQL playlist
https://www.youtube.com/playlist?list=PLwcl8DqLMv9ckBqQJEyVNGsMmEsjMb-m7

Build User Registration with PHP & MySQL playlist
https://www.youtube.com/playlist?list=PLwcl8DqLMv9dwiAIsHs3uANHxGpGo7tyK

Support me on Patreon
https://www.patreon.com/maxpronko

Learn Magento 2 on Mage Mastery
https://magemastery.net
Promotion on this channel: [email protected]

Subscribe for more videos!
--
Twitter: https://twitter.com/max_pronko
Website: https://www.maxpronko.com
Business Enquiries: https://www.pronkoconsulting.com/

Тэги:

#development #tutorial #howto #php #php_router #php_tutorial #php_for_beginners #custom_php_router #php_routing #php8 #php7 #phpstorm #php_framework #how_to_write_php_router #php_router_library #development_class_10
Ссылки и html тэги не поддерживаются


Комментарии:

@4rmboy666
@4rmboy666 - 27.01.2024 19:08

The most useful video demonstrating the MVC pattert in php that i watched so far.

Ответить
@faratanzaki
@faratanzaki - 02.01.2024 16:25

like this one : $router->get('/contact/{$id}', function($param){
echo $param;
});

Ответить
@faratanzaki
@faratanzaki - 02.01.2024 16:23

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

Ответить
@paulhetherington3854
@paulhetherington3854 - 15.06.2023 21:20

PHP' = Her personal productive! American Tribes

Ответить
@petrusmattiasdughem1899
@petrusmattiasdughem1899 - 04.01.2023 11:52

Hello can you use php built in webserver and connect to database?

Ответить
@dieselkapasule4370
@dieselkapasule4370 - 23.12.2022 19:25

Thanks a lot, Max, quite a helpful video.

Ответить
@fatkur
@fatkur - 08.12.2022 19:13

so cool dude!

Ответить
@entertainyou1855
@entertainyou1855 - 22.11.2022 06:53

Can you share the source code used here

Ответить
@giorgiobarone9784
@giorgiobarone9784 - 16.11.2022 19:59

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

Ответить
@marshalldteach1109
@marshalldteach1109 - 23.10.2022 13:06

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

Ответить
@zeeu
@zeeu - 21.08.2022 18:51

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

Ответить
@khaledeladawe7769
@khaledeladawe7769 - 28.07.2022 15:49

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

Ответить
@andgoedu
@andgoedu - 11.07.2022 18:16

Thanks alot mate it actually works <3.

Ответить
@asifurrahman5436
@asifurrahman5436 - 10.06.2022 08:32

Hey after implementing the router i am getting a database erro saying: "Database Error: could not find driver", please help me

Ответить
@trevorchristianamedayenou1982
@trevorchristianamedayenou1982 - 30.05.2022 10:03

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!

Ответить
@firstignitor
@firstignitor - 10.04.2022 00:02

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

Ответить
@rssimran4800
@rssimran4800 - 14.03.2022 19:00

Where is source code

Ответить
@grumpyjarl7336
@grumpyjarl7336 - 27.01.2022 13:24

dude how can you handle scenario of items/{item-id} in this aproach ? thanx

Ответить
@catch_me_outside_how_bout_dat
@catch_me_outside_how_bout_dat - 19.01.2022 20:50

I am confused. How does the passing an array named params to a callback function associate the variable to the incoming request query params?

Ответить
@kelolettek3927
@kelolettek3927 - 11.01.2022 19:12

Hi how to include css file to phtml please I cant find

Ответить
@373323
@373323 - 28.12.2021 12:37

unfortunate i ended up with a code base that does not work, it falls through to addNotFoundHandler, and there is no git repository of published material i can look up to help me figure out where i went wrong.

Ответить
@MrLinuxFreak
@MrLinuxFreak - 20.12.2021 14:06

great guide!
can you do a guide about adding middlewares? particularly for validate requests values

Ответить
@MrJBisoy
@MrJBisoy - 02.11.2021 08:50

Can you add dynamic routing along with pattern match ??

Ответить
@olezhonnv3215
@olezhonnv3215 - 09.10.2021 11:56

Єврейський трохи роутер. Але більш-менш.

Над вимовою попрацюй. Або веди канал на рідній мові.

Ответить
@manishdeshpande
@manishdeshpande - 03.10.2021 06:16

Hi Max,
Can you provide the link to the code in the video?
Thanks much.

Ответить
@lucassouzasilva6842
@lucassouzasilva6842 - 07.09.2021 00:27

Hey this help me so much thanks

Ответить
@outerstring8747
@outerstring8747 - 06.08.2021 10:26

awesome i would interested to see a whole MVC framework😍

Ответить
@PrakashPrakash-sn3do
@PrakashPrakash-sn3do - 21.05.2021 17:59

Awesome information Thank you so much

Ответить
@NhatNguyen-xo9gs
@NhatNguyen-xo9gs - 17.04.2021 12:54

It is useful. Thank you for sharing

Ответить
@ashmoore3709
@ashmoore3709 - 13.04.2021 17:08

First :D

Ответить