PHP For Beginners, Ep 33 - Build a Better PHP Router

  Рет қаралды 24,204

Laracasts

Laracasts

Күн бұрын

Пікірлер: 43
@liderVarna
@liderVarna 29 күн бұрын
I am amazed how well you present each video. I received a lot of useful information, a lot of useful advice from you. Thank you!
@VideoDarslar
@VideoDarslar Жыл бұрын
Thanks for the lesson. I didn't understand what really happens behind the scenes in Laravel and now I do 😊
@andreymikhalev7464
@andreymikhalev7464 Жыл бұрын
Cool thing will be later to show how {param} variables can be appended to routes
@DougLopes
@DougLopes Жыл бұрын
Amazing didatics as always (i'll say it again, even for us that already use the language for long time)... I'd just add constants in Router class for each method, because it bother's me using "magic strings" even if its used once.
@karlheinzneugebauer
@karlheinzneugebauer Жыл бұрын
I thought I was the only one thinking that way.
@hugo-abdou
@hugo-abdou 2 жыл бұрын
i have a filing that this series will end up with laravel as final result hhhhh
@lucasj.pereira4912
@lucasj.pereira4912 2 жыл бұрын
It is probably the point. Teach the users how the MVC and logic works so it's easy for someone to start on Laravel or keep it as mini-framework for small projects. I did something similar with a course teaching like this and in the end started Laravel and was like: "Hey, it's really similar" and was really easy to migrate a project to the framework.
@Laracastsofficial
@Laracastsofficial Жыл бұрын
It's precisely the point. :) I want to make onboarding to any PHP framework as intuitive as possible. When you try Laravel after completing this series, you'll think to yourself, "Oh, I totally get this."
@Syed_haze
@Syed_haze Жыл бұрын
@@Laracastsofficial 🥳💝
@hugo-abdou
@hugo-abdou Жыл бұрын
@@Laracastsofficial thank you i love the way you explain with
@michaellamas6479
@michaellamas6479 Жыл бұрын
Great how you explain it step by step. I love it. The method add is public, but on that point it could be private like the variable routes, couldn't it?
@faisal.fs1
@faisal.fs1 27 күн бұрын
dude is building a framework
@notnotkeshav
@notnotkeshav 4 ай бұрын
I have written all the routes using the router->get() syntax, but only the top 1 is getting rendered rest all are showing Error404.php page 😢. Can somebody help me?
@lucianasofiamorales4634
@lucianasofiamorales4634 3 ай бұрын
Could you solve it? I have the same issue.
@لوسيفرجبريل
@لوسيفرجبريل Ай бұрын
@@lucianasofiamorales4634 are you sure your mysql server is working? I am using mamp and sometimes the mysql server does not start and I have to stop the server and start it again for it to work.
@andromilk2634
@andromilk2634 2 ай бұрын
Is there a reason we used strtoupper($method) here even though we already hardcoded the strings in capitals in the view for the desired method? Just to be sure in case we might have forgotten to capitalize one?
@whisperscribe
@whisperscribe 7 ай бұрын
great stuff Jeffrey!
@AK2000YY
@AK2000YY 3 ай бұрын
this episode is a little hard, but amazing
@jediampm
@jediampm 2 жыл бұрын
Hi, great video. One thing that i do not understand is how in note route route ( show route) , the URI match ? since that route has a query string, which query string is in URI should not match. Another thing, i think that in first version of this series, at root of routes array you create the methods as keys and associate the respective route ( uri + controller) to method key, so you had assoc array instead of index array that you have now in this new series. And why not use preg_match?
@Laracastsofficial
@Laracastsofficial Жыл бұрын
Because we're only getting the path, not the query string. $uri = parse_url($_SERVER['REQUEST_URI'])['path'];
@jediampm
@jediampm Жыл бұрын
@@Laracastsofficial Ya, after i post the comment i went to review the code and reach the same conclusion, lol. Anyways should be useful for others.
@davidasadi5041
@davidasadi5041 2 жыл бұрын
Thanks for awesome tutorials I learn a lot about core php 👌👌👌
@marcrebadina1489
@marcrebadina1489 Жыл бұрын
Hi @Laracastsofficial how do you handle the routes for images inside the uploads folder? It always goes to 404 even on direct URL. Or even CSS/JS folder so I can add it dynamically on my routes.
@ajaybagdia
@ajaybagdia 9 ай бұрын
used this code with IIS Server with web.config file to send each file to public/index.php but could not load the static files like .js, .css and images can you guide
@gherosh
@gherosh Жыл бұрын
Why wont use URI as $routes array key in order not to cycle the $routes array for finding the matching REQUEST URI?
@martinmata3675
@martinmata3675 Жыл бұрын
is there a way to get the code of this video??
@DaviMartins99
@DaviMartins99 2 жыл бұрын
Anyone knows what theme Jeffey is using here? I tried Googling, but only found the old theme in Laracasts.
@devanii
@devanii Жыл бұрын
i think materialize?
@Laracastsofficial
@Laracastsofficial Жыл бұрын
It's called Carbon. All of the things I use are listed here: laracasts.com/uses
@lserranoit
@lserranoit Жыл бұрын
Hey Jeffrey, is the source code available?
@binuavin
@binuavin Жыл бұрын
That meme😂😂
@chzmo
@chzmo Жыл бұрын
You the best 👌
@Dev.Waleed
@Dev.Waleed 10 ай бұрын
I tried a lot on your routers but these are not working, even on real website i tried to implement it not working.
@alikaram98
@alikaram98 Жыл бұрын
Tanks a lot
@rustamergashev7278
@rustamergashev7278 5 ай бұрын
👍
@mahdielhajuojy1112
@mahdielhajuojy1112 Жыл бұрын
you the best
@arindam7demon
@arindam7demon Жыл бұрын
No doubt
@Syed_haze
@Syed_haze Жыл бұрын
can we stand against AI with php ?
@Dev.Waleed
@Dev.Waleed 10 ай бұрын
Your routers way isn't working . I tried a lot but getting in trouble each time. I also tried to implement it on real hosted website to analyze either may be something wrong with my virtual php environment but still it's not been working.
@johnnybrunerdesigns
@johnnybrunerdesigns 6 ай бұрын
Did you ever figure it out? Nothing is working for me either with this new router.
@johnnybrunerdesigns
@johnnybrunerdesigns 6 ай бұрын
Is anyone still monitoring this playlist? Everything has worked great until this video. The new routing system has broken everything and nothing works.
@OZTutoh
@OZTutoh 9 күн бұрын
I just tried it myself. Yep, everything broken. Real mad because I wanted to learn sessions 5 lessons on from this one. EDIT: I checked the source code from the link in the description and discovered in Core/Router.php, I'd used 'controllers' => $controller, instead of 'controller' => $controller, It worked after that.
@paulbrugger9610
@paulbrugger9610 Жыл бұрын
In order to actually save a new note and to delete a note, routes.php should be $router->get('/', 'controllers/index.php'); $router->get('/about', 'controllers/about.php'); $router->get('/contact', 'controllers/contact.php'); $router->get('/notes', 'controllers/notes/index.php'); $router->get('/note', 'controllers/notes/show.php'); $router->get('/notes/create', 'controllers/notes/create.php'); // Jeffrey forgot these last two routes $router->post('/notes/create','controllers/notes/create.php'); $router->delete('/note','controllers/notes/show.php');
PHP For Beginners, Ep 34 - One Request, One Controller
7:08
Laracasts
Рет қаралды 11 М.
PHP For Beginners, Ep 31 - Namespacing: What, Why, How
12:09
Laracasts
Рет қаралды 15 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
PHP For Beginners, Ep 39 - Write Your First Middleware
22:05
Laracasts
Рет қаралды 24 М.
Simple Routing with PHP | Functional Programming
4:36
Max Pronko
Рет қаралды 21 М.
PHP For Beginners, Ep 15 - Make a PHP Router
18:03
Laracasts
Рет қаралды 61 М.
Is this the best PHP Routing library?
16:17
Coders Page
Рет қаралды 20 М.
PHP For Beginners, Ep 47 - Composer and Free Autoloading
13:13
When to use Traits, Interfaces, and Abstract Classes in PHP
15:08
Andrew Schmelyun
Рет қаралды 24 М.
PHP For Beginners, Ep 35 - Make Your First Service Container
19:23