PHP Superglobals - Basic Routing Using The Server Info - Full PHP 8 Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ม.ค. 2025

ความคิดเห็น • 173

  • @zeeu
    @zeeu 2 ปีที่แล้ว +19

    Ladies and Gentlemen, you've finally made it to the fun part

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +2

      It gets more fun later on 😉

    • @zeeu
      @zeeu 2 ปีที่แล้ว +2

      @@ProgramWithGio that's what I meant 😁

  • @mwaas
    @mwaas 2 ปีที่แล้ว +5

    You explain the hidden and essential things in frameworks.
    I will always be grateful to you

  • @yinonelbaz5309
    @yinonelbaz5309 2 ปีที่แล้ว +11

    With every new video I progress in this series, I get excited and excited all over again, it's unbelievable how great and in-depth this series is! Thanks gio for the investment!!!

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      Very happy to hear that you are progressing and videos are helpful, thank you 🙌

  • @isaacsouza17
    @isaacsouza17 3 ปีที่แล้ว +27

    Laravel really hides does detail for us, but it is important to understand the fundamentals, thanks again for the free high quality content, keep it up

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +4

      Agreed. Pretty much all frameworks hide & abstract away such things. You're very welcome Isaac & thank you 🙌

  • @mauriciocastro7572
    @mauriciocastro7572 2 ปีที่แล้ว +7

    just as a reminder, for the router to work the server must be configured so that it redirects traffic to index.php, i was stuck in this for days without realising gio had already setup his server a few videos ago haha.
    this is seriously the best guide on php programming, much love

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Yea we covered that earlier. Thank you 💙. Here is the repo to outline that includes all videos in order: github.com/ggelashvili/learnphptherightway-outline

    • @deZOO77
      @deZOO77 2 ปีที่แล้ว

      Thx man. I've been strugling with this for few hours, wondering what I did wrong, until I saw your comment:)

    • @VuPhuongThanh-BDCCN
      @VuPhuongThanh-BDCCN 2 ปีที่แล้ว

      I use xampp and Could you help me how to configured router, i am very appreciate ?

    • @salvaddd
      @salvaddd ปีที่แล้ว

      Omg it happened the same to me! I was wondering for a couple of hours what was the problem. Maybe a little note should be added about this, as for example I started a second environment for this video without configuring the index redirect.

    • @tommauro2023
      @tommauro2023 ปีที่แล้ว

      Me too! For the ones that might have the same problem all the necessary configurations is in the tutorial about docker.

  • @asifm3520
    @asifm3520 3 ปีที่แล้ว +5

    Really appreciate your efforts in explaining every minute details. Great explanation. Thumbs up.

  • @benderbg
    @benderbg 5 หลายเดือนก่อน

    This lesson even if its just basics really shows how much work it takes to router a few pages and how awesome frameworks have become in speeding up that process.

    • @ProgramWithGio
      @ProgramWithGio  4 หลายเดือนก่อน

      Yup, frameworks make our lives a lot easier for sure

  • @2008rol
    @2008rol 3 ปีที่แล้ว +3

    Agree with Isaac Souza. When first time I met Laravel, I really liked to know how its router works. But I found it was quite hard to trace. After watching this video, Gio gave me a lot more understanding on how router works. Thanks a lot

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +1

      Thank you, glad to hear that 🙌

  • @NooBGaming23
    @NooBGaming23 ปีที่แล้ว

    Usually, I never comment but hats off to you! Thanks for that quality of knowledge.

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +1

      I appreciate that, thank you 💙

  • @karolzamojcin1886
    @karolzamojcin1886 ปีที่แล้ว

    Man, once you get the algorithm wave your sub base is going to skyrocket! Thank you 🙂

  • @HeroGamingMaroc
    @HeroGamingMaroc ปีที่แล้ว +1

    Hi guys , im in love with this cours and thank gio , im correcting my university teacher errors 😂 beacuse of gio

  • @Vitalii-m6r
    @Vitalii-m6r ปีที่แล้ว

    Thanks for this extraordinarily useful PHP series again!

  • @abdallakaram5376
    @abdallakaram5376 3 ปีที่แล้ว +1

    Gio is the best ❤

  • @sergeykonov4562
    @sergeykonov4562 8 หลายเดือนก่อน

    please provide video to project with symfony and laravel(step by step)

    • @ProgramWithGio
      @ProgramWithGio  8 หลายเดือนก่อน

      Thank you for your support. I'm working on Laravel course currently

  • @AMoktar
    @AMoktar ปีที่แล้ว

    Awesome 👏, 👍

  • @ינוןאלבז-כ1ז
    @ינוןאלבז-כ1ז 2 ปีที่แล้ว

    Amaizing!!!! Thanks!!!!

  • @emekatimothyiloba699
    @emekatimothyiloba699 ปีที่แล้ว

    Wow Thanks Gio. now i understand how Laravel Route works

  • @mortezashabanipour6597
    @mortezashabanipour6597 2 ปีที่แล้ว

    Thank you, you bring me back to life. Someday i,ll tell you the whole story

  • @slavmin
    @slavmin 3 ปีที่แล้ว

    Perfect explanation!

  • @mohammadalikarami9961
    @mohammadalikarami9961 3 ปีที่แล้ว

    Please continue the good work. Amazing php course.

  • @federicobau8651
    @federicobau8651 3 ปีที่แล้ว +1

    Great video

  • @devnullex
    @devnullex 3 ปีที่แล้ว

    Very very very great job! I love PHP. Keep goin

  • @memack101
    @memack101 2 ปีที่แล้ว

    Thank you.

  • @mortezashabanipour6597
    @mortezashabanipour6597 2 ปีที่แล้ว

    I couldnt sell any learning course beacuse of bad economy situation. And free online learning break my knowledge to seperate small parts. And i thought its not any better then these. But when i find you right in the time i,m going to very badly depression ....
    I cant show my entire respect in words... thank you
    You,re perfect , awesome excellect teacher
    Thank you so much

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      You're welcome, I'm glad these are helpful, thank you & stay strong

  • @adrianez-programuj3313
    @adrianez-programuj3313 3 ปีที่แล้ว

    Top quality content and explanation. Keep going.

  • @pedroblancobarrera6013
    @pedroblancobarrera6013 ปีที่แล้ว

    Thou I have to watch a couple of times each videos to understand how it works behind the scenes, its really interesting how good things are done.

  • @ilya_123__
    @ilya_123__ ปีที่แล้ว

    thank you!

  • @Nukker13
    @Nukker13 3 หลายเดือนก่อน

    For some reason, I get stuck on 8:33 part of the video, when the router is optimized to work with arrays. Any idea what could be fixed? It just throws the same routes error that is created earlier in this lesson, no idea why the URIs are not cathed properly.

    • @ProgramWithGio
      @ProgramWithGio  3 หลายเดือนก่อน

      I'd have to look at your code to help you

    • @Nukker13
      @Nukker13 3 หลายเดือนก่อน

      @@ProgramWithGio is it possible to contact you? I saw you mentioned Twitter DMs, but I'm not sure if you're responding to such questions

    • @ProgramWithGio
      @ProgramWithGio  3 หลายเดือนก่อน

      Twitter is the best way. I do respond it when I have free time

  • @galacticmeditation6764
    @galacticmeditation6764 ปีที่แล้ว +1

    This function can be use to get url path:
    $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);

  • @nemac23
    @nemac23 2 ปีที่แล้ว

    10:50 Probably a dumb question, but why do this check? Why not always pass array to controller - what's the use of keeping callable option?

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      Not a dumb question at all. Its for convenience, you may want to register route based on a closure instead of an array. If you only want to use arrays you are free to do that.

  • @VuPhuongThanh-BDCCN
    @VuPhuongThanh-BDCCN 2 ปีที่แล้ว +3

    I write code exactly the same in video but when i type /invoices into url , it throws an error 404 not found , The requested URL was not found on this server.
    Can anyone help me , i use xampp

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      DM me on Twitter on Monday and I'll help you troubleshoot, send me screenshots of your code or better put it on GitHub and send me the link

    • @suvarnanishaa
      @suvarnanishaa ปีที่แล้ว

      I am encountering the same issue. how did you solve the issue?

    • @chilibean6152
      @chilibean6152 8 หลายเดือนก่อน

      Actual proplem

  • @lahcenaouina
    @lahcenaouina ปีที่แล้ว

    Thank u so much , i have problem with routes not work correctly in appache

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      You're welcome. Any specific errors?

    • @lahcenaouina
      @lahcenaouina ปีที่แล้ว +1

      @@ProgramWithGio no errors but it gives me Page Not found , when i make own server (php -S localhost:5050) it work

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Probably some misconfiguration, I would need to see your apache configs, if you can DM me screenshots of your configs on Twitter I can help troubleshoot it

    • @lahcenaouina
      @lahcenaouina ปีที่แล้ว

      @@ProgramWithGio Ok thank u

  • @porag_raihan
    @porag_raihan 2 ปีที่แล้ว +1

    Hey boss, I can't type hint the $message property. The error shows that "Type of App\Exceptions\RouteNotFoundException::$message must not be defined (as in class Exception)".

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Hey, that's because in the base class there is no typehint on that property, so you can't type hint it in the child class either

    • @musilicks
      @musilicks ปีที่แล้ว

      @@ProgramWithGio why wouldn't they typehint in the base class? typehinting is fun, Lord Gio.

  • @devanii
    @devanii 2 ปีที่แล้ว +1

    i don't understand this piece [$class,$method] = $action the left side is an array which you replace with actin but it is still available later?

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +2

      It's called array destructuring. We covered it in first section: th-cam.com/video/E4FUeWa3WQk/w-d-xo.html at around 13 min or so

    • @devanii
      @devanii 2 ปีที่แล้ว

      @@ProgramWithGio thanks! I saw many videos before this one but i could not remember this was explained :)

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      @@devanii no problem 👍

    • @Moriarty1982
      @Moriarty1982 2 ปีที่แล้ว

      @@ProgramWithGio maybe an info link to the video with the timecode would be helpful for others?
      th-cam.com/video/E4FUeWa3WQk/w-d-xo.html

  • @mwaas
    @mwaas 2 ปีที่แล้ว +1

    12k view and just 500 like
    This course is free gold, at least hit the like button as a gratitude and thanks

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      I appreciate it, thank you 💙

  • @olisaisama7083
    @olisaisama7083 ปีที่แล้ว

    Thank you mate. How can i include dynamic parameters on the routes or edit the query strings to fit something like /xyx?

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Later in the course we use a proper router that provides such features

    • @olisaisama7083
      @olisaisama7083 ปีที่แล้ว

      @@ProgramWithGio thanks that will do alot digging

  • @KochADV
    @KochADV หลายเดือนก่อน

    Was using vscode and getting an error from the $requestUri... didnt try to debug.. will continue learning and perhaps look at this later. Great video again. Thanks

  • @DanielKhadivi
    @DanielKhadivi ปีที่แล้ว +1

    How do you navigate to the "invoice' page and still end up showing 'resolve' on index.php? Can't follow your routing example here. All other tutorials are great!

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Because all requests go through the index.php, thats where router is instantiated & proper route resolved

    • @DanielKhadivi
      @DanielKhadivi ปีที่แล้ว

      @@ProgramWithGio If you type a url ending in "/invoice" wouldn't that navigate to the "index.php" page? Why would it go to the main page at 'index.php'?

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      ​@@DanielKhadivi Request goes to the index.php & then index.php invokes the router which decides which page to render

    • @DanielKhadivi
      @DanielKhadivi ปีที่แล้ว

      @@ProgramWithGio Thank you for taking the time to respond. I have defined a "About.php" page in a "Pages" subfolder. The PHP server is configured using IIS / FastCGI, not Apache.
      When I type "localhost/phpTutorial/App/Pages/About.php", it goes directly to that page The full path on OS is:
      C:\inetpub\wwwroot\phpTutorial\App\Pages\About.php
      This seems to be the correct behavior of navigating to web page. The "app" root is at: "C:\inetpub\wwwroot\phpTutorial\App" .
      Again, I see no reason for the request to go to the "index.php" at the root of the app (where I have done similar registration to yours in your video), and then somehow redirect itself to the "About" page. There is no redirection logic. Sorry, I'm new to PHP and love your tutorials. What am I doing wrong?

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      What you are doing doesnt really follow with what we are doing in this lesson. In this lesson we set up routing in a way so that all traffic is routed through public/index.php, so that acts as our front controller. Then we have the router that maps the request URI to the controller & the action, so when /about is requested it executes AboutController::index method & so on

  • @Zubbee
    @Zubbee 2 ปีที่แล้ว

    Always wanted to know how routing was done and all. However this was a bit tough to grasp. I don't know weda to stay on it or to move on. I think I have a hint that the laravel frame work makes it easier but I always like to understand concepts at least. Thank you for this video Gio

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      It's alright, I would say move on & come back to it later.

    • @Zubbee
      @Zubbee 2 ปีที่แล้ว

      @@ProgramWithGio Ok Gio I'll do just that. Thank you very much.

  • @Armando-px8hi
    @Armando-px8hi ปีที่แล้ว

    Thank God Laravel exists 😂 Thank you GIO, just one question how did you learn PHP man, sometimes I just think it was written by you))

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Laravel is awesome, so is Symfony. I always keep on learning new things, I don't know/remember everything off the top of my head every time. Sometimes I forget the simple things. The key thing is, being able to figure it out when its needed.

  • @morteza55510
    @morteza55510 2 ปีที่แล้ว

    What is the difference between Home::class and new Home()?

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      new creates a new object of that class, Home::class just references the fully qualified class name

    • @morteza55510
      @morteza55510 2 ปีที่แล้ว

      @@ProgramWithGio oh, thanks

  • @louisolitaire424
    @louisolitaire424 ปีที่แล้ว

    Hey Gio, I can’t thank you enough for making such a valuable content available on YT. That series is just amazing and the way you teach is brilliant!
    I have a quick question on this one though and I figured maybe you or someone else could help. I don’t understand how you can pass an array as the first argument in the call_user_func_array function. Is the array somehow casted into a callable? And if so, does it mean that we can invoke arrays shaped like this [App\MyClass, ‘method’]() ?
    Thanks again 😉Gratitude from France!

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +1

      Hey, thank you for the kind words. In PHP callable can be defined as an array as well with first element being the object or the class name and the second element being the method. You can check the docs for the callable type for more info: www.php.net/manual/en/language.types.callable.php

    • @louisolitaire424
      @louisolitaire424 ปีที่แล้ว +1

      Thanks a lot for the explanation.

  • @emekatimothyiloba699
    @emekatimothyiloba699 ปีที่แล้ว

    Hey Gio. Please why is the error message displayed that way "Uncaught RouteException". Is there not a way to display the neat error message??

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Because its an unhandled exception, you can create exception handler or use try/catch

  • @gatzmamora1178
    @gatzmamora1178 ปีที่แล้ว

    Hey Gio, or anyone listening...
    Thanks Gio for this course, it is fantastic!
    I'm just having an issue where if I try to call a method from a class like [classes\Home::class, 'index'];
    it gets called as an array with "classes\Home" and "index" as a string. Does this technique for calling methods from methods from classes not work anymore?

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +1

      Hey, I'm not sure I understand the question, how are you calling the method? Do you use call_user_func_array?

    • @gatzmamora1178
      @gatzmamora1178 ปีที่แล้ว

      I missed the step where I had to add |array to the callable type in the register method. Got it! Thanks for replying and for this class!

  • @EgorDemeshko
    @EgorDemeshko 11 หลายเดือนก่อน

    i got a question, this code with create Route object runs every time script is requested?

    • @ProgramWithGio
      @ProgramWithGio  10 หลายเดือนก่อน

      yes on every request. Frameworks usually cache routing

  • @Artorias_DS
    @Artorias_DS ปีที่แล้ว

    Hi Gio I was wondering what file extension you use for creating files. By the way, I really enjoy your content - it's always great.

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Hello. Not sure what you mean, for which files? For PHP files I use .php extension

    • @Artorias_DS
      @Artorias_DS ปีที่แล้ว

      @@ProgramWithGio Hi, Gio. it's at 7:10, the way you created the class file. it's very convenient, would like to learn how to do it. Thank you

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      @@Artorias_DS that's just the IDE (phpstorm) making things easier, it creates the PHP class. Files still have PHP extension.

  • @sheenismhaellim2215
    @sheenismhaellim2215 3 ปีที่แล้ว +2

    Sir, i need to donate to your channel. You have patreon?

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +1

      Thank you. I don' have Patreon yet, best way to support me, for now, is to like my videos, comment on them & share whenever you can. That helps a lot with the algorithm to bring my videos in front of other developers. Thank you so much, I really appreciate it 🙏

    • @devnullex
      @devnullex 3 ปีที่แล้ว +1

      Now he has - www.patreon.com/programwithgio

  • @stephen.cabreros
    @stephen.cabreros 2 ปีที่แล้ว

    w0w this is so good, I didnt know this syntax [App\Classes\Invoice::class,'index']( ) would work to call its method if index method is static

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      It's just an array. I wouldn't recommend having static controller methods.

  • @AhmedAdel-xg1cm
    @AhmedAdel-xg1cm 2 ปีที่แล้ว

    Hi Gio, Really appreciate your efforts in explaining every minute details :)
    I just have a question, my dream is to be back-end dev, i studied c++, oop, data structure and algorithms, design patterns and system design
    and i learnt Nodejs, express and mongodb but somtething happend to me made me forget nodejs and i decided to learn php laravel so could you please tell me what i need to learn to achieve this goal ? my plan is to finish this amazing series and move to mysql and laravel so what do u think ?

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +2

      Hello. That's a good plan, you can finish the series and move on to Laravel, you can learn Laravel from Laracasts and having finished this series should help you learn Laravel faster.

    • @AhmedAdel-xg1cm
      @AhmedAdel-xg1cm 2 ปีที่แล้ว

      @@ProgramWithGio Thank u so much for replying back to me, i really appreciate that,
      u are so kind and nice. u try to help people that u do even not know and for free. u are amazing :) . I hope i could be greate dev like u in the future, u are my role model

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      @@AhmedAdel-xg1cm you're welcome and thank you 💙. I'm certain you will be a better dev than me, what it takes to be a good dev is dedication and consistency and I think you got both, good luck 🤞

    • @AhmedAdel-xg1cm
      @AhmedAdel-xg1cm 2 ปีที่แล้ว

      @@ProgramWithGio Thank you :)

  • @hieunguyen0801
    @hieunguyen0801 3 ปีที่แล้ว

    can you guide me how to fix the syntax error, unexpected '|', variable expect(T_VARIABLE)

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว

      Sure, if you can show me the code I can take a look at it but that is a syntax error, check the variable name

    • @hieunguyen0801
      @hieunguyen0801 3 ปีที่แล้ว

      public function register(string $requestMethod, string $route, callable|array $action): self {}.
      Vs code unexpected '|', expecting variable (T_VARIABLE)

    • @ProgramWithGio
      @ProgramWithGio  3 ปีที่แล้ว +1

      @@hieunguyen0801 whats your PHP version, union types are supported in PHP8 so most likely you are on PHP 7.4 so it won't work. Remove the type hint with | character and use docblock instead

    • @mahmudsulemansheikhwunnam3580
      @mahmudsulemansheikhwunnam3580 3 ปีที่แล้ว

      @@ProgramWithGio perfect

  • @RedZambala
    @RedZambala ปีที่แล้ว

    I had big problems with this routing... First, I could not make it work at all in Laragon folder; Then, since I have a small website & domain - I tried it in subdomain, and with small adjustments (for PHP 7.3, without Composer, on a shared hosting) - I was able to make this router work in subdomain's root; but then, I was trying to make it work in a Directory, I could not make it work; or may be I failed to set .htaccess right... even though - ChatGPT could not find a problem, but it didn't work.

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Sounds like a very specific issue to your setup, maybe related to Laragon. Glad you figured it out though, good job

  • @DigitaSkills101
    @DigitaSkills101 2 ปีที่แล้ว +1

    How is one script running on all pages you are not even including them

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      All requests go through public/index, we set that up in Docker/nginx video

  • @abdfadee8267
    @abdfadee8267 ปีที่แล้ว

  • @HeroGamingMaroc
    @HeroGamingMaroc ปีที่แล้ว

    Please gio can u do Laravel 10 full cours

  • @OmarFedior
    @OmarFedior 6 หลายเดือนก่อน

    Using XAMPP and can't get Routing to work?
    Try to check it out this video: th-cam.com/video/ytVPiYILz80/w-d-xo.html
    Where Program With Gio explains step-by-step how to rewrite server rules.

  • @jeffsnow7464
    @jeffsnow7464 2 ปีที่แล้ว +2

    Great videos as always!
    If you're like me and you forgot how he got all his requests to show the $_SERVER['REQUEST_URI'] variable even when he wasn't loading index.php, it's because of server configuration he did in his 1.29 video th-cam.com/video/ytVPiYILz80/w-d-xo.html (about 11 minutes in) using mod_rewrite on the server to direct all requests to index.php.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Thank you. Note that we are not using Apache/xampp in section 2. We are using nginx so config is a bit different, same idea though 👍

    • @orenders
      @orenders ปีที่แล้ว

      @@ProgramWithGio you are using autoload.php but didnt mentioning about, nothing works from this video. Im shocked of comments, its like 99% PROs here or fake comments.

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +3

      @@orenders Dude you are skipping videos, we covered autoload in episode 2.5, this is video 2.23, there is a link in the description of this video to a github repo with outline that lists all episodes. Either watch the series as its meant to be watched or just go watch somebody else's tutorial instead of stressing yourself out.
      This is not just a one off lesson, its entire series that is meant to be watched from beginning to the end. I cant explain every single thing in every single video, that would make having series pointless and would make each video hours long. So either move on to some other tutorials or just watch previous videos.
      Nothing is fake here and not everyone is pro, a lot of beginners started this course and are following along just fine.

  • @EgorDemeshko
    @EgorDemeshko 11 หลายเดือนก่อน

    [RESOLVED] i don't undestand how $this->routes[$route] = ['App\Home', 'index'] would leed to a callable syntax; next in resolve method where return call_user_func($action)

    • @EgorDemeshko
      @EgorDemeshko 11 หลายเดือนก่อน

      ["/invoices/create"]=> array(2) { [0]=> string(20) "App\Classes\Invoices" [1]=> string(6) "create" }

    • @EgorDemeshko
      @EgorDemeshko 11 หลายเดือนก่อน

      sr, i needed to watch several seconds further)

    • @EgorDemeshko
      @EgorDemeshko 11 หลายเดือนก่อน

      call_user_func_array - from docs A method of an instantiated object is passed as an array containing an object at index 0 and the method name at index 1. Accessing protected and private methods from within a class is allowed.
      now it's undestandable;

    • @ProgramWithGio
      @ProgramWithGio  10 หลายเดือนก่อน

      awesome, glad you figured it out. Good job

  • @69leostereo
    @69leostereo 2 ปีที่แล้ว

    until watching this video ... I thought routing was kind of magic or witchcraft ... thanks.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      That's awesome, glad you found it helpful 🙌

  • @naturebc
    @naturebc หลายเดือนก่อน

    useless, doesn't work because you left out the most important detail. That's what frameworks do to you

    • @ProgramWithGio
      @ProgramWithGio  หลายเดือนก่อน

      Care to explain what exactly doesn't work or what detail I left out? And what does frameworks have to do with it?

    • @naturebc
      @naturebc หลายเดือนก่อน

      @@ProgramWithGio .htaccess

    • @naturebc
      @naturebc หลายเดือนก่อน

      @@ProgramWithGio .htaccess, without this config routing doesn't work.

    • @ProgramWithGio
      @ProgramWithGio  หลายเดือนก่อน

      Did you watch previous episodes in the series or you are just watching this one. You dont always need htaccess, especially if you have access to the main configuration (which we configured it in the apache lesson). So before making assumptions or making insults, maybe ask?
      Here is the video about apache & htaccess files: th-cam.com/video/ytVPiYILz80/w-d-xo.html

    • @naturebc
      @naturebc หลายเดือนก่อน

      @@ProgramWithGio no why would I watch the entire series? I’m not a newbie. I’m just looking for specific ideas. You can’t talk about routing without talking about the system that makes it work.

  • @truthteachers
    @truthteachers ปีที่แล้ว

    One of the odd things i find is that the info produced by $_SERVER differs terribly when I use xampp to run the script and when i use the PHP inbuilt server "php -S localhost:3000". I am using Windows 10 and PHP 8.1.12. This conflict becomes critical when i try to get REQUEST_URI parameter. When i use Xampp i get "/MyCoursesLG/php/courses/piocourse/src/public/" but when i use inbuilt server i get "/". This creates unnecessary coding variations especially when i tried to create basic routing. Why does this happen and how to resolve this?

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว

      Found this now, for some reason TH-cam did not notify me about this. I've answered this to your comment in another video (2.25).