Routing, Controllers, Views - Part 1 | PHP MVC Framework from Scratch

Поделиться
HTML-код
  • Опубликовано: 7 янв 2025

Комментарии • 397

  • @TheCodeholic
    @TheCodeholic  2 года назад +27

    If you have the following error at 56:55
    call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method app\controllers\SiteController::handleContact() cannot be called statically
    You have to make some changes in Router class. During the time of making this framework PHP version was allowing calling non-static method statically, but later it was changed.
    Here is fix...
    At 31:07 instead of calling call_user_func($callback) directly, we need to create an instance of the controller first.
    if (is_array($callback)) {
    $callback[0] = new $callback[0];
    }
    return call_user_func($callback);

    • @TheCodeholic
      @TheCodeholic  2 года назад

      Does your controller have correct namespace?
      Try to put \ in front of app\controller\SiteController

    • @TheCodeholic
      @TheCodeholic  2 года назад

      @Đinh Như Khang I mean in index.php

    • @TheCodeholic
      @TheCodeholic  2 года назад

      You have something wrong in either index.php or in SiteController

    • @blessdarah1256
      @blessdarah1256 2 года назад

      @Đinh Như Khang I also have this type of problem. The temporal solution was to make the function in the controller static. I'm stilling looking of a good fix to work without having to make all controller functions static.

    • @blessdarah1256
      @blessdarah1256 2 года назад +1

      This solution works perfectly fine. Tested and it's working.

  • @tutanchacon
    @tutanchacon Год назад +8

    Three years later, it remains a great contribution to the community!
    Thanks for all

  • @Gorbatsjov27
    @Gorbatsjov27 4 года назад +11

    Never worked with a (MVC) framework in my life and your explaination is super clear and easy to comprehend. You have a gift to do this. Keep doing this please.

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      Huge thanks man. APPRECIATE

    • @m3awna
      @m3awna 4 года назад

      how long have you been a developer?

    • @Gorbatsjov27
      @Gorbatsjov27 4 года назад +1

      @@m3awna I'm not a developer. At least not professional. In my spare time I'd like to program. And I did that on and off for the last 20 odd years. Mostly HTML and CSS, a bit of PHP and even less JS.

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      @@m3awna I started coding 10 years ago and it's almost 9 years I work as a developer.

    • @m3awna
      @m3awna 4 года назад +1

      @@TheCodeholic we entered this field around the same time, but you're doing a lot better than me :) thanks for the tuts

  • @mohammadaminsamadi9341
    @mohammadaminsamadi9341 3 года назад +3

    i think this is the best php tutorial for building MVC FRAMEWORK

  • @stms999
    @stms999 3 года назад +8

    I am a beginner so I can't judge others' code but I know clean code when I look at one. Readable, organized and it's only the first video. Fantastic work!!

  • @azatnurzhanuly7290
    @azatnurzhanuly7290 4 года назад +2

    Thank you, I did not even need to increase the playback speed because the narration is on point!

  • @HondoUS
    @HondoUS 2 года назад +3

    Just finished Part 1. I really learned quite a bit.
    Some constructive feedback:
    - Maybe breaking the video down into shorter parts. There were a few points where I felt the video could have ended and a new one started.
    - For those not using PHPStorm, maybe clarifying when PHPStorm automagically adds something.
    - Maybe a little less jumping around; can be confusing for novices.
    Great job and extremely thorough explanation! Thank you!

  • @amirulfitri3751
    @amirulfitri3751 4 года назад +3

    Y u didn't have more viewssss! Just discovered your channel and immediately subscribed. Please continue the hard work, you're amazing.

  • @Akosiyawin
    @Akosiyawin 4 года назад +3

    Holy macaroni, I also created my own framework which is similar to your routing approach, But this is entirely more creative and object oriented, I might as well try this and re write my code. Thanks for this, God Bless you!

  • @lanreoreyomi9555
    @lanreoreyomi9555 4 года назад +7

    This is crazy amazing. I never knew PHP was this cool. Thank you. Thank youuuuuuuuuuuuuuu

    • @TheCodeholic
      @TheCodeholic  4 года назад +3

      You're very welcome! PHP is very cool language.

    • @lanreoreyomi9555
      @lanreoreyomi9555 4 года назад

      @@TheCodeholic Thank you. Do you offer mentorship? That's one thing I am missing in my career development

    • @TheCodeholic
      @TheCodeholic  4 года назад

      Do you mean one to one teaching?

    • @lanreoreyomi9555
      @lanreoreyomi9555 4 года назад

      @@TheCodeholic not really. It's someone you reach out to for some career advice. Share development process and also, help you become a better developer.

    • @TheCodeholic
      @TheCodeholic  4 года назад +4

      I do this for junior developers in my company. And I plan to express this on my youtube channel.

  • @arturobatista8015
    @arturobatista8015 2 года назад +1

    i am not an english speaker but i learned so much with this video, thanks :D.

  • @dungaland
    @dungaland 4 года назад +4

    Lots of thanks. Is something i have been looking for for years

  • @LEXUANPHAT
    @LEXUANPHAT Год назад +1

    Hello,
    I'm Vietnamese, I've watched your video and I see your video is very good, there's a lot of PHP stuff that I don't know yet.

  • @jakubgadzala7474
    @jakubgadzala7474 3 года назад +3

    Thank you for your hard work sir! This could definetely be a paid course. One more time, hats off to you sir, and a million thanks.

    • @TheCodeholic
      @TheCodeholic  3 года назад +1

      Thanks buddy.
      It means a lot for me.

    • @jakubgadzala7474
      @jakubgadzala7474 3 года назад

      @@TheCodeholic I have finished your course on Traversy Media, and now started this one. It helps a lot. Never seen anybody iterating over one subject like you do. It's simply amazing. I would love to become your acolyte and work for you on daily basis

  • @neilacero6761
    @neilacero6761 4 года назад +2

    I knew that accent sounded familiar, and then the surname appears! Great tutorial. Madloba!

  • @neutralengineer3873
    @neutralengineer3873 3 года назад +1

    Hats off ❤️❤️❤️
    Love from 🇮🇳 India.

  • @홍성남-m3q
    @홍성남-m3q 4 года назад +2

    You are really a genius.
    I want to give you thumbs-up as many as I can.

    • @TheCodeholic
      @TheCodeholic  4 года назад +2

      Thank you buddy.
      However I am not a genious at all. I am just very hard working person and this framework show also this.
      I did it 3 times to finally create video on it.
      But thanks once again...
      Appreciate your feedback...

  • @PROTOTURKCOM
    @PROTOTURKCOM 4 года назад +1

    1:01:30 why you didn't use extract() instead of $$? Is there any cons?

    • @TheCodeholic
      @TheCodeholic  4 года назад

      I think $$ is easier to use. I do not know TBH if there is any cons.

    • @PROTOTURKCOM
      @PROTOTURKCOM 4 года назад

      Than I believe this code is
      extract($params)
      easier than this :D
      foreach($params as $key => $value){
      $$key = $value;
      }
      don't you think so?

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      I think you are right.
      Just I have not used that before.

    • @PROTOTURKCOM
      @PROTOTURKCOM 4 года назад +1

      ​@@TheCodeholic you taught me something, I taught you something :) thanks for exchange.

    • @TheCodeholic
      @TheCodeholic  4 года назад

      Thanks.

  • @ilya_123__
    @ilya_123__ 10 месяцев назад

    Thank you a lot!. After 3 times i watched and workout this lesson i begin to understand! Lets go ahead! Your lessons is great!

  • @terrymurray2076
    @terrymurray2076 4 года назад +9

    Excellent Job! You mentioned that this framework is for educational purposes only. I was wondering what has to be done to make it suitable for production.

    • @TheCodeholic
      @TheCodeholic  4 года назад +7

      It needs to be tested, bug fixed and improved for next several months only after that I would say it would be ready for production

    • @_zetrax
      @_zetrax 4 года назад +7

      @@TheCodeholic Can you make a video on how to test and bug fix software for production development. BTW, nice video.

  • @mrtayyabmughal7209
    @mrtayyabmughal7209 4 года назад +10

    Excellent, thanks, please make lectures on Laravel framework, if you have time 👍

    • @moazamali2434
      @moazamali2434 4 года назад +1

      Ya i am too looking forward for that

  • @kadirookirim3231
    @kadirookirim3231 3 года назад

    thank you, i think this is the best php tutorial for building MVC FRAMEWORK

  • @mouhamaddiop1144
    @mouhamaddiop1144 4 года назад +2

    The way you code is very nice and understandable. Thanks a lot

  • @mehdielfatihi9459
    @mehdielfatihi9459 4 года назад +3

    thank you very much , building an MVC framework is an awesome way to help people understand how real Frameworks like laravel works under the hood , keep going bro I just start learning backend development .

  • @rashadmammadov8201
    @rashadmammadov8201 Год назад

    it is a gold material thanks for sharing it on youtube for free you are great man

  • @sevdinkojic6212
    @sevdinkojic6212 4 года назад +5

    Very good approach with the evolution step by step ans very well explained, you did a great job congratulation and i hope that you have the courage to continue like this because it's lot of work. Thank you for sharing your knowledge with the community, i follow and and gonna share your channel !!!

    • @TheCodeholic
      @TheCodeholic  4 года назад

      Huge thanks Sevdin. Such comments are what I am doing all this for. The more such comments I see the bigger will be my motivation.

  • @yves2522
    @yves2522 2 года назад +1

    Your're a great developer and...a very good teacher. Thanks a lot for sharing so much knowledge! It saved me weeks of reading and testing ;-)

  • @saadnasim3032
    @saadnasim3032 10 месяцев назад

    you deserve a subscribe ... Thankyou for this amazing tutorial

  • @PeterMumford
    @PeterMumford Год назад +1

    This lesson was outstanding. It is the single best example of how to implement OOP in PHP that I've seen.

    • @TheCodeholic
      @TheCodeholic  Год назад

      I am super happy to hear that. Thank you.

  • @rajeshbudhathoki7888
    @rajeshbudhathoki7888 4 года назад +2

    Wow!😍😍 Thank you millions for making the series! 🙏🙏

  • @bicancezar-catalin3402
    @bicancezar-catalin3402 3 года назад +2

    It's amazing the way you explain, thank you for this tutorials and for the time spent in creating this piece of art.

  • @Lucas-hh4oh
    @Lucas-hh4oh 3 года назад +1

    Hey, thanks for the tutorials! Its really give me deep insight on how most of the framework actually work!

  • @mohammadtaheri98
    @mohammadtaheri98 4 года назад +2

    good job man, everything in order. very clear and perfect

  • @fatihkara6411
    @fatihkara6411 3 года назад +1

    thank you very much from Turkey

  • @АнтонВогусов
    @АнтонВогусов 2 года назад +3

    Hi everybody! May I ask you a question? On 56:08 when you pass an array with classname and non-static function to 'call_user_func()', how does it work with a class but not an object of this class in passed array? If class is passed it should call method statically, but it is non-static method 'contact' (or 'handleContact')? Thank you))

    • @user-cl6zn6sc2k
      @user-cl6zn6sc2k 2 года назад +2

      yes i have the same question, I don't get why can he call it as static method when is not

    • @ΓιώργοςΜουχταρίδης
      @ΓιώργοςΜουχταρίδης 2 года назад

      @@user-cl6zn6sc2k Same question here

    • @zaakhirpouzi283
      @zaakhirpouzi283 2 года назад

      For php8 may refer here php.watch/versions/8.0/non-static-static-call-fatal-error

  • @rafaelrosas59
    @rafaelrosas59 4 года назад +2

    Thank you so much for this content, the way you explain is very understandable

  • @coderboysobuj
    @coderboysobuj 4 года назад +4

    It’s really great tutorial. Go ahead sir..❤❤

  • @nurharizulaimanmatharith4023
    @nurharizulaimanmatharith4023 4 года назад +1

    The most greatest work....thanks bro your knowledge is awesome

  • @ruhollahh01
    @ruhollahh01 4 года назад +3

    Thank you for this great tutorial.

  • @renrevz8140
    @renrevz8140 2 года назад

    It was never too late to learn again Thank you so much for the absolute tutorial you have been making❤️❤️ keep up the good work

  • @fajar312
    @fajar312 4 года назад +1

    thank you, very helpful and very neat and structured like a laravel router

    • @TheCodeholic
      @TheCodeholic  4 года назад

      Thanks buddy

    • @fajar312
      @fajar312 4 года назад

      @@TheCodeholic You are welcome, friend

  • @dccastro2182
    @dccastro2182 4 года назад +1

    Porra !! Eu esperei por este conteúdo há muito tempo, e agora chegou na minha cara!!

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      Excellent!!! Hope it will teach you something.

  • @alighazal3978
    @alighazal3978 4 года назад +1

    thank you so much .. it is an awesome series

  • @dmxd
    @dmxd 3 года назад +1

    Router is pronounced "rauter", or "ruter", but not "roter". Excellent tutorial. Thank you.

    • @dmxd
      @dmxd 3 года назад +1

      "instead" is pronounced "insted", not "instid".

  • @viggolagerstedtekholm4166
    @viggolagerstedtekholm4166 3 года назад

    You are amazing dude, solid stuff.

  • @the.mikeyy
    @the.mikeyy 4 года назад +2

    01:00:54 you can also use PHP's 'extract' function, it basically does the same thing but it is cleaner.

    • @TheCodeholic
      @TheCodeholic  4 года назад

      Thanks.

    • @tesszheng4586
      @tesszheng4586 3 года назад

      awesome, extract() function is a handy one, thanks, I learnt a new function

    • @aidanayala8549
      @aidanayala8549 2 года назад +1

      using extract is recommended against when dealing with data that could come from an untrusted source

  • @feli75
    @feli75 4 года назад

    Thank You, your explanation was very understandable

  • @tarikgadoumi1297
    @tarikgadoumi1297 2 года назад +1

    ofc i subscribe to you budy ! i like the way you explain keep up hero !!!!!

  • @ebedkharistian1472
    @ebedkharistian1472 3 года назад +1

    Glad I found this 👍👍👍

  • @mahyarbehzadi738
    @mahyarbehzadi738 3 года назад +1

    thanks for this great course 👌👌🔥

  • @grupoprosperidade2383
    @grupoprosperidade2383 4 года назад +1

    Very useful! Thank you.

  • @alikaram98
    @alikaram98 Год назад +1

    wow so good thank's a lot bro

  • @mladentrickovic744
    @mladentrickovic744 4 года назад +1

    Keep it going buddy u helped a lot.

  • @alisidali580
    @alisidali580 3 года назад +4

    First of all i want to thank you for this great tutorials, there is one question about call_user_func function because does not accept non static method as second parameter if first parameter is not an instance, and thank you again.

  • @ashifahamed9916
    @ashifahamed9916 Год назад

    its really grate, So much helpful.

  • @fleckenfurz77
    @fleckenfurz77 2 года назад

    Hi Zura!
    Thank you so much for the tutorial and for the immense effort behind it!
    But..
    I'm kinda stuck at 56:55min...and i am very confused!
    How is it that you can call handleContact without the SiteController being instantiated???
    Because for me an error is thrown consequently:
    "Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method app\controllers\SiteController::handleContact() cannot be called statically in... (stack trace)...C:\Users\User\Desktop\Code2022\Custom_MVC_Framework\core\Router.php on line 67"

    • @TheCodeholic
      @TheCodeholic  2 года назад +1

      Thank you.
      I created pinned comment on the video, which explains the problem and what should be done to fix it.

  • @TahirBhai
    @TahirBhai 4 года назад

    Amazing tutorial, you just got new subscriber today.

  • @ИгрокИграющийИгры
    @ИгрокИграющийИгры 4 года назад +4

    Very, very nicely done tutorial. Great material. Thanks. Only one thing: You are running toooo fast, way to fast. Its hard to follow if, I am making this project while watching. Really hard to stay on same page. While pausing video every 10seconds is an option, its little hard to keep in mind what and why I was doing 1min ago, so I got to rewind back, making me go through same material again and again. Just slow down a little. Would be amazing. Probably just, me, but still. Thanks for amazing content. Best one I found so far. :) Keep it up.

    • @TomiBorchert
      @TomiBorchert 2 года назад

      this problem is very common amongst tubers. videos are designed for native english speakers.

    • @TomiBorchert
      @TomiBorchert 2 года назад

      when learning, speed should not be priority.

    • @ИгрокИграющийИгры
      @ИгрокИграющийИгры 2 года назад

      @@TomiBorchert yes. I Agree posted comment 1 year ago. Still following channel. Really useful information here. Thank you. :)

    • @HustlemanHustlonian
      @HustlemanHustlonian Год назад

      Just play it at half speed in the RUclips settings

  • @rjaysharma
    @rjaysharma 4 года назад +1

    WoW😘😘, Loved it..👍👍

  • @kmlclktrk
    @kmlclktrk Год назад +1

    Veri great tutorial🎉❤ thanks a kot

    • @kmlclktrk
      @kmlclktrk Год назад

      İf possible could you tell me what is your choice?
      Laravell or your mvc routing?

  • @josechirino5168
    @josechirino5168 4 года назад +2

    This is amazing, thank you

  • @dfordemo981
    @dfordemo981 3 года назад +1

    Amazing course, I am learning a lot of thins from your videos ____

  • @arnavchandra
    @arnavchandra 4 года назад +1

    You have a gifted voice... The way you explained is superb... It's a lot of work a bigg salute to the hard work you have put in.
    Just one question or point, the ones using Xampp or Wamp will not get the same errors as php built-in server?

    • @arnavchandra
      @arnavchandra 4 года назад

      In addition it would be great to install sentinel native or having sentinel native installed in any MVC other than Laravel ... in case just an idea... u can carry forward this same MVC integrating it with Twig and Sentinel it would be awesome... We can have Twig in one part and Sentinel in another ...

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      Thanks buddy.
      Yes they will have the same output on xampp installation.

    • @arnavchandra
      @arnavchandra 4 года назад

      Apologies by output I mean errors ... Corrected in my comment 😊.
      There are a few, I would say smart logics you used here ... I tried the codes but Xampp was showing 404 without configuring it .. I am using php 7.4.9 ver Xampp

  • @angelabad8294
    @angelabad8294 2 года назад +1

    amazing video man.

  • @vxarlanchuk
    @vxarlanchuk 4 года назад +3

    56:52 I got Deprecated: call_user_func() expects parameter 1 to be a valid callback, non-static method app\controllers\SiteController::handleContact() should not be called statically in C:
    ginx-1.18.0\www\mvcFramework\core\Router.php on line 39. PHP v. 7.4.9

    • @TheCodeholic
      @TheCodeholic  4 года назад +2

      By the end of the video I have changed the code and don't call the function statically any more...
      Check the final version of the code

    • @Renodarkholes
      @Renodarkholes 4 года назад

      @@TheCodeholic I have the same problem but I don't find the final version of the code. On Github, the core folder is missing

    • @sekhniashvili
      @sekhniashvili 4 года назад +1

      @@Renodarkholes If you watch the video series till the end, you will see that I delete the core folder and make it reusable composer package. So the final version is definitely without core and is available on my Github.

    • @Renodarkholes
      @Renodarkholes 4 года назад

      @@sekhniashvili Ok Thank you for your videos, I like ;-)

    • @Raihan004
      @Raihan004 4 года назад +5

      it will solve the issues
      if(is_array($callback)){
      return call_user_func([new $callback[0], $callback[1]]);
      }

  • @HeshamShawky1
    @HeshamShawky1 2 года назад +1

    First of all .. thank you for this great tutorial it was very useful
    second thing in 56:40 there's an issue in calling 'handle contact' method in the site controller class ... i think the method is been called in a class context while the method hasn't been declared as static .
    hope to correct me if i'm wrong .
    thank you :)

    • @ThePancakeJedi
      @ThePancakeJedi 2 года назад

      Yes. How to fix this? I got stuck here.

    • @deZOO77
      @deZOO77 2 года назад

      @@ThePancakeJedi yo can add static keyword in method declaration

    • @thevipinchand4690
      @thevipinchand4690 2 года назад +1

      @@ThePancakeJedi You can do this $app->router->post('/contact', [(new SiteController), 'handleContact']);

  • @ShamsuddeenAbdulkadir
    @ShamsuddeenAbdulkadir 3 года назад +1

    Hello The codeholic, this is a very awesome tutorial and thanks very much for it. I just discovered your channel yesterday and quickly made the decision to take this particular framework tutorial, and i have learned a lot of new things already. I have reached 43:08 mins on this video but my browser doesn't show any content at that point. I am running php 7.4.21 and apache on ubuntu 20.04. any hint on what might be causing it would really help. Thanks one more time.

    • @jadidlar4765
      @jadidlar4765 3 года назад

      use echo instead of return. Return is not showing messages on me

    • @Korzk
      @Korzk 2 года назад +3

      I know its late but try to put echo before $this->router->resolve in Application.php

  • @jasongoossens
    @jasongoossens 4 года назад +1

    Awesome course! Your code is clear, and practically explains itself!
    It kinda looks like you're implementing the Node & Express way in PHP?

    • @kofestotech
      @kofestotech 4 года назад

      I guess slim PHP framework implemented something like that

    • @TheCodeholic
      @TheCodeholic  4 года назад

      Thanks

  • @terrymurray2076
    @terrymurray2076 3 года назад +1

    Hi. When using the handleContact method from the SiteController class I get the warning that handleContact should be called statically. Can you help me with this? When I make the method static the warning goes away.

  • @safara_umarov
    @safara_umarov 4 года назад +4

    ❤❤❤❤❤ thank you a lot))

  • @mustafaagha8834
    @mustafaagha8834 3 года назад

    Amazing tutorial

  • @TITAN-sv5eg
    @TITAN-sv5eg 2 года назад

    0:36 why it's not recommended to use in products or websites ?

  • @simplydevelopments3736
    @simplydevelopments3736 3 года назад +2

    Great Tutorial. On 1.01 why not use extract($params)

  • @netman87
    @netman87 4 года назад

    Oh my this earns my sub

  • @bgray79
    @bgray79 4 года назад +1

    I'm currently at time stamp 31:54, am using xampp, Firefox and VS Code. I have tried adding 'users' to the URL, and received 'Object Not Found' error. At this point, when I navigate to the public/index.php file, 'Not Found' is displayed, and not 'Hello World.' Any thoughts on this? Thanks.

    • @TheCodeholic
      @TheCodeholic  4 года назад

      If you are using xampp you have to setup virtual host.
      If you want to follow the tutorial I advice to start the server using php -S. And only switch to apache virtual host later...

    • @bgray79
      @bgray79 4 года назад

      If i dump the routes array in the router->resolve function, I get '/' and 'home' and '/contact' and 'contact'. When the $callback = $this->routes[$method][$path] line is run, the array does not have a method stored, so $callback is false.

    • @TheCodeholic
      @TheCodeholic  4 года назад

      Probably you have something differently

    • @bgray79
      @bgray79 4 года назад

      @@TheCodeholic by virtual host, are you referring to something different than the Apache server on the Xampp control panel?

    • @geneartista9714
      @geneartista9714 4 года назад +1

      at your cmd:
      - cd 'your public folder path'
      - php -S localhost:8080
      at your web server type:
      localhost:8080

  • @shaikhanuman8012
    @shaikhanuman8012 4 года назад +2

    Thank you very much sir 👍😊😊😊😊😊😊😊😊😊😊😊😊😊😊 very informative this is type of teaching we are expecting. In one hour we are doing coding very interesting and exciting thanks for providing great lectures.

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      Thank you Shaik,
      Glad to read such comments...

    • @shaikhanuman8012
      @shaikhanuman8012 4 года назад +1

      @@TheCodeholic I am prodly say your my teacher.

  • @romanliapkin5174
    @romanliapkin5174 3 года назад

    Hey, Zura, this project is awesome! You have done a great job. But one thing I would like to the project. Would be cool if the video was splitting into chunks which may observe on GitHub. Now if go on GitHub you see the eventual result. Excuse me for my insolence. THANK YOU for worry about a beginers. А project like this so few on the internet.

    • @romanliapkin5174
      @romanliapkin5174 3 года назад

      Hmmm, I'm downloaded your project and by switching among commit of the project I found a point that I want to see in the video. Would be good if you add the timing of the video into the commits on GitHub.

  • @TheSaurus1233
    @TheSaurus1233 4 года назад +3

    Thanks a lot for the tutorial! I'm learning a lot. I had one question, how do I add those comments at the top when generating the classes? Thank you.

    • @TheCodeholic
      @TheCodeholic  4 года назад

      You need to open phpstorm settings, find file templatea there and change it.

  • @xuanatluu8101
    @xuanatluu8101 4 года назад

    17:28 what happen?
    Parse error: syntax error, unexpected 'Router' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

    • @aliberkyurtoglu8504
      @aliberkyurtoglu8504 4 года назад +1

      Your PHP version may be low version. Should be a minimum 7.4
      If your php version is greater than 7.4 and you still get this error;
      Windows + S > write Edit the System Environment variables > System Environment variables > Edit the 'Path' in user variables and system variables. Your PHP version may not be up to date. Here you add the current version

  • @twentxx
    @twentxx 3 года назад +1

    Thank You very much! It's very helpful ☀️👍
    Also I have a one question. Why we need a function setLayout in Controller if we can use variable $layout for function of Router - layoutContent?

  • @sviatstupak2162
    @sviatstupak2162 Год назад

    Well done!

  • @amralaaeldin
    @amralaaeldin 3 года назад

    56:30
    please, how to call class method while neither the class has instance nor the method is static??
    I tried it and it doesn't work, I really don't know how it works here!

    • @amralaaeldin
      @amralaaeldin 3 года назад

      @Raymond Bitterling
      Actually I don't remember how I solve it exactly, but I think I used static keyword.

    • @amralaaeldin
      @amralaaeldin 3 года назад

      @Raymond Bitterling
      may you mention the episode or the timestamp in which he did it?
      I revised my project and I did use static keyword

  • @creepersonspeed5490
    @creepersonspeed5490 3 года назад +1

    This is so good

  • @rudotel112
    @rudotel112 3 года назад +1

    It is correct if we renderView from the Response class?

  • @Ananaskirsche12
    @Ananaskirsche12 3 года назад

    Very nice video! One improvement would be to put the timestamps in the description, so one can rewatch one aspect :)

  • @hammadhassanhashmi
    @hammadhassanhashmi 4 года назад +1

    Did you create .htaccess? Because index.php is not serve when I typed /users it is showing page not found

    • @jjmontgo2
      @jjmontgo2 3 года назад

      He is using the built-in php web server. .htaccess is for Apache.

  • @marcowebdesign3463
    @marcowebdesign3463 3 года назад

    Hi!! Great tutorial!!!
    I've a problem with the code. The code stucks with an error 500. I'm currently at timestamp 55:55
    127.0.0.1:48408 [500]: GET / - Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, function "App\Controllers\SiteController" not f
    ound or invalid function name in /home/nhytros/localweb/mwd_framework/app/Core/Router.php:38
    Line 38 says: return call_user_func($callback);
    How can I fix this?

  • @freshgold09
    @freshgold09 Год назад

    Thanks for posting this awesome video which is really help me. But I wonder how to replace if there are 2 or more placeholders in views?

  • @spencer5028
    @spencer5028 2 года назад

    Recommend modeling this with UML so the viewers can get a basic understanding of the structure and flow of requests through the app/

  • @topalek
    @topalek 4 года назад +2

    сразу лайк, неглядя ))

  • @davidtaiwo1848
    @davidtaiwo1848 Год назад

    great job, i find it easy to do whatever i want with this framework. I have issues identifying if the framework used is laravel or yii2 or any other. I am new to programming and i will appreciate you to clarify this for me. Thanks

    • @TheCodeholic
      @TheCodeholic  Год назад

      It is not Laravel or yii2. It is new framework created to help you understand how frameworks work.

  • @zharbysalazar9795
    @zharbysalazar9795 3 года назад +1

    I dont know why but I keep getting error in good version from this code
    call_user_func($fn);
    Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($callback) must be a valid callback, non-static method app\controllers\MainController::create() cannot be called statically in
    but if I changed it to var_dump it turns out fine which leads to not calling the controller. Please help guys

  • @An-Nur_Info-Tech
    @An-Nur_Info-Tech 2 года назад +2

    I got to know you through freecodecamp on a course posted PHP MVC Framework, the course was so great and here I am on your channel and everything you've been posting was great and easy to learn. Thank you for the great work you've been putting into this.
    I tried integrating bootstrap with composer require tubs/bootstrap instead of the CDN linking, after everything was downloaded into the vendor folder I linked it in the layout folder main.php but it's not working out. Any help on this, please?

  • @geoffreyngugi6144
    @geoffreyngugi6144 4 года назад

    some one assist me, I can get past 49:01. post method don't seem to be working
    $app->router->post('/contact', function (){
    return 'handling submited data';
    });
    When I remover post method, everything works fine.

    • @TheCodeholic
      @TheCodeholic  4 года назад +1

      Can you provide more information? Or the whole repository?

    • @geoffreyngugi6144
      @geoffreyngugi6144 4 года назад

      Hello codeholjc, I solved the problem, it turned out I had mispelt the post method .
      Thanks for the reply and the good work you are doing teaching the whole world

  • @martinnyagah4313
    @martinnyagah4313 2 года назад +1

    If you are following along and got this error:
    Uncaught TypeError: call_user_func(): Argument #1 ($ca
    llback) must be a valid callback, non-static method app\cont
    rollers\SiteController::handleContact() cannot be called statically in /opt/xampp/htdocs/phpMvc/core/Router.php:43
    Stack trace:
    change:
    [new SiteController::class, 'handleContact']
    to:
    [new SiteController(), 'handleContact']

    • @asheaven1st
      @asheaven1st 2 года назад

      Works like a charm.. Thank you..

  • @sqdtnz
    @sqdtnz 2 года назад

    It's been so long ago since I worked with PHP, I vaguely remember I did this routing with a .htaccess file, but either I was doing it wrong back then, or a better way has arrived?

  • @moussaouimehdi734
    @moussaouimehdi734 4 года назад

    great tutoriel it helps me a lot and took me one day to understand and test all things. I found just one error and i know it will be mentionned in the next videos. In the last video the _404 page not found dosen't work because in the layoutContent method we try to access to the propriety controller of the Application and it's not initialized ($callback null).

  • @kuhaniresti
    @kuhaniresti Год назад

    the problem with exiting framework is they are not based on domain driven design, one example of concerns is, they load view classes and other dependencies related to text/html for application/json requests. they executes a lot of defaults that not going to be needed for outputting the reply. imagine having access to title for json request.

  • @tiagovieira6653
    @tiagovieira6653 4 года назад +2

    Can someone help me?
    I'm using mamp, and I have to have a file htaccess in order to redirect to index everytime I type something that shows me not found... So without htaccess my router.php does not work because the request dont go to index.php, is there any other way or htaccess files are mandatory? Because I see that He does not need It... and in his git files, there's no htaccess file... so that means if he uploads the files to a webserver that will work without problem? Tyvm

    • @Akosiyawin
      @Akosiyawin 4 года назад

      There's a solution for that using htaccess

    • @Akosiyawin
      @Akosiyawin 4 года назад +2

      RewriteEngine on
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ /index.php?path=$1 [NC,L,QSA]

    • @Akosiyawin
      @Akosiyawin 4 года назад

      You need to put that where your index is located

  • @ninononikashvili2945
    @ninononikashvili2945 Год назад

    Hi and many thanks to you. I got a question regarding comments. which plugin do you use to generate comments automatically? ant the comments follow psr standards am I right?