PHP MVC Pattern - View Parameters Exploit - Full PHP 8 Tutorial

PHP MVC Pattern - View Parameters Exploit - Full PHP 8 Tutorial

Program With Gio

3 года назад

38,672 Просмотров

Ссылки и html тэги не поддерживаются


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

hot wings
hot wings - 21.08.2023 12:52

I have been going back and forth, i decided i prefer my own framework ive built myself.

Ответить
Артем Гаврюк
Артем Гаврюк - 21.08.2023 11:17

I want to thank you for the amazing educational content! Thank you so much!

I have a question about the following topic:

In the View class, within the make method, we are returning new static($view); :
public static function make(string $view, array $params = []): static {
return new static($view);
}


However, in the HomeController controller, we are calling the make method in the following way:
public function index() {
return View::make('home');
}

This means that an instance of the View class will always be created. However, in the make method, we are using new static for some reason. But with this usage, when calling View::make('home'), an instance of the class in which this call is made will never be created. So, why do you specifically use new static($view) instead of new self($view) or new View($view)? What are its advantages?

Ответить
Vitalii
Vitalii - 16.08.2023 17:20

This PHP course is astonishing! Thanks a million!

Ответить
Armando 2626
Armando 2626 - 28.07.2023 01:40

The diagram versions was the best actually it helped me a lot to understand for what each of MVC stays for, I have used Laravel a lot and it really covers all this topic, watching the video one time gave me some problems. Thanks a lot GIO. Also please one question about autoloading, Is there any easy way for autoloading using spl_autoload_register() this function or not?

Ответить
Mostafa jaffal
Mostafa jaffal - 18.07.2023 22:28

Hello, I would love to know differences between PHP frameworks like Laravel and Symphony, you mentioned that Laravel is more than an implementation of MVC and its way more powerful. do you recommend any resources about this topic? or make separate video explaining the differences please. btw the whole course is just marvelous. keep it up!

Ответить
破軍歌姬
破軍歌姬 - 08.07.2023 12:07

Don't use that, it is bad. Use file_get_contents and str_replace to avoid variable and buffer contamination.

Ответить
Paschal Okafor
Paschal Okafor - 22.06.2023 13:21

This should be everyone's one stop shop for anything relating to PHP. Thank you GIO.

Ответить
rustavellyne
rustavellyne - 04.06.2023 11:44

Thank you! (comment in support of channel)

Ответить
Lahcen Aouina
Lahcen Aouina - 28.05.2023 17:14

Hi Teacher , I built upgrade functions View
public function render(bool $IsContent= false) {
$viewpath = VIEW_PATH . '/' . $this->view .'.php';
$template = file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..\View\view.html');
if ($IsContent) {
$content = file_get_contents(__DIR__.DIRECTORY_SEPARATOR."..\View\\".$this->view.".php");
$template = str_replace('{{content}}' ,$content ,$template);

return $template;

}else {
if (!file_exists($viewpath)) {
echo "VIEW : FILE CONTAIN VIEW NOT AVALBLE OR FORGOT EXTENSION";
}
ob_start();
include $viewpath;
return (string) ob_get_clean();
}

but i dont know how to add navbar for all pages (and this navbar check if user Logined or not )

Ответить
Emeka Timothy Iloba
Emeka Timothy Iloba - 24.05.2023 10:53

thanks

Ответить
James Ussery
James Ussery - 17.05.2023 03:52

Gio your tutorials are solid! My son and I are following and everything is working but one piece. We aren't able to get the router to process curly brace vars I couldn't find the router code in your git because this lesson is missing. Where can I find that?

Ответить
Amir Zare
Amir Zare - 18.03.2023 13:50

Thanks for your useful videos
I also use validations in the controllers and form requests :)

Ответить
Kristian Koribsky
Kristian Koribsky - 13.03.2023 21:18

Hello Gio, thank you for this amazing course! Just a quick question: Isn't using ob_get_flush() better instead of ob_get_clean() in this case? According to docs, ob_get_clean() doesn't turn off output buffering. In majority of cases I think it probably doesn't matter since render is the last thing we will be returning, but there could be some problems with multiple renders maybe? Let me know what you think, thanks! :)

Ответить
Alex
Alex - 07.03.2023 17:59

Why are you teaching something that is "not to be used in production", obviously just wasting time. Why not teach something that is usable in production. I am sorry, cannot fathom that.

Ответить
ulijiB kadelM
ulijiB kadelM - 20.02.2023 08:19

I just build a project with simple MVC pattern and kinda jump to this video early bcs I wanna know more about the MVC. Now I feels demotivated like I haven't really learn anything.

Ответить
unjoined
unjoined - 19.01.2023 22:38

Gio I'm sorry my brain stopped..why does the method render needs to return a string? Amazing series btw.

Ответить
ינון אלבז
ינון אלבז - 16.01.2023 01:33

Amen!

Ответить
Luis Eduardo Swart
Luis Eduardo Swart - 11.12.2022 12:28

i dont understand the new static() return from the make function...is that an anoymous class? what is the reason to return an object

Ответить
Ahmed Adel
Ahmed Adel - 02.12.2022 18:30

Hi Gio, thank you so much for this amazing lesson, u are amazing teacher :)
I have a question please, I decided after finishing this series i will jump into laravel but before that
what if i learn how to create MVC like laravel from scratch, this MVC will have the below
Custom Routing
- Composer
- Controllers
- Views/Layouts
- Models
- Migrations
- Form widget classes
- Processing of request data
- Validations
- Registration/Login
- Simple Active Record
- Session Flash messages
- Middlewares
- Application events
- Framework reusable/installable core

Do you think this will be a good project to put it in my CV and help me to be better PHP DEV??

Ответить
Leandro Roggerone
Leandro Roggerone - 04.11.2022 16:25

im loving this serie ... could you share this code ?

Ответить
Шейх Мансур
Шейх Мансур - 31.08.2022 11:33

thanks

Ответить
Ramon McDonald
Ramon McDonald - 18.08.2022 14:38

Thank you.

Ответить
Dark and Darker Brasil
Dark and Darker Brasil - 09.08.2022 23:07

This video is a mess e the explanation is boring, feels like a continuation, but the title does not imply that.

Ответить
B4rt1j1
B4rt1j1 - 03.08.2022 16:27

Including file between ob_start and ob_get_clean is not working, do you think the problem might be in php.ini config? ob_end_flush works instead

Ответить
issa issifou
issa issifou - 24.07.2022 13:11

Thank you so much!

Ответить
Reza Dehghani
Reza Dehghani - 20.07.2022 09:56

So thanks gio, you are so help me!

Ответить
Przemysław Niemiec
Przemysław Niemiec - 25.06.2022 15:32

Is this code available to download?

Ответить
Zuby
Zuby - 13.06.2022 13:20

Gio thanks for this, the MVC pattern makes a lot of sense. It kinda seems like a lot but it's totally scalable. I'm learning.

Ответить
Rimantas Danilevicius
Rimantas Danilevicius - 01.06.2022 23:55

Thank you for sharing your knowledge. Maybe by chance you have plans to create reliable MVC framework which can be used in production? It is very hard to find reliable content and good practice.

Ответить
Stephen Cabreros
Stephen Cabreros - 31.05.2022 15:11

is it ok to use ob_start() to include an entire html with a lot of css and javascript animation and return it as a string with ob_get_clean()?

Ответить
Dev Henry
Dev Henry - 21.05.2022 01:26

Can you please teach us that how to create a full MVC framework from strach. Would be very helpful. I like your teaching style...
Also please add this functionality in MVC framework like .. how to add elequent Orm And blade template engine...
I have intermediate knowledge of laravel but I want to know how actually laravel work behind the scenes.
Also sometimes I feel that laravel is to heavy framework for smaller projects... That's why I want to build custom MVC framework that has same mvc pattern like laravel and use some of laravel packages that provides orm and template engine packages for easy manipulate database and view..

I really appreciate for your kind tutorial.

Ответить
Вкусные рецепты
Вкусные рецепты - 16.05.2022 17:27

Maybe stupid question...
Class View in this code is a Model?

Ответить
Francisco Junior
Francisco Junior - 08.05.2022 18:33

the content is amazing, thank you very much.

Ответить
Sasha
Sasha - 04.02.2022 09:59

This was an awesome leasson Gio! Much easier to follow after the clear visual presentation at the beginning.
That's it for this week. See you on Monday!

Ответить
Gergely Csermely
Gergely Csermely - 28.01.2022 10:27

Thanks

Ответить
Leeroy Prins
Leeroy Prins - 24.01.2022 18:30

This series is a serious gem

Ответить
Federico Baù
Federico Baù - 09.01.2022 15:22

This PHP course / Bootcamp is amazing

Ответить
Aleksandr Kanygin
Aleksandr Kanygin - 26.12.2021 02:54

When i tried to implement MVC pattern myself sometime ago, at first i did all the validation in controllers, but it looked really ugly with all the validation logic so i moved validation to models. Adding separate layer to handle it sounds like an ideal solution. Your channel is da best btw :DD

Ответить
Aleksandr Kanygin
Aleksandr Kanygin - 26.12.2021 00:26

Thanks for making clear all the differences in diagram versions, when i tried to understand mvc earlier, seeing all these different diagrams was really confusing.

Ответить
Pat
Pat - 12.12.2021 22:42

Amazing job and coverage, are you also going to make a seperate lesson on layouts? Thank you for your hard work!

Ответить
Tutoriales Honestos 🦅
Tutoriales Honestos 🦅 - 05.11.2021 21:18

Excelente guía, nosotros también hicimos un tutorial sobre MVC, pero lo adecuamos al uso cotidiano para darle una aproximación mas humana.. pero este que claro de igual manera =)

Ответить
Zeljko L.
Zeljko L. - 28.09.2021 15:19

I made layout.php file (html layout), within the body I have include $viewPath. In the View class I made DEFAULT_LAYOUT constant that points to that layout.php, then in the render method between ob_start and ob_get>clean I include that DEFAULT_LAYOUT. It seems to be working for now, dont know will it cause problems later :)

Ответить
Jakub Šrédl
Jakub Šrédl - 20.08.2021 23:59

Hello, amazing videos - is possible to download source code for that MVC pattern? thank you

Ответить
mohammad ali karami
mohammad ali karami - 03.07.2021 13:27

Amazing job!

Ответить
Mahmud Suleman Sheikh Wunnam
Mahmud Suleman Sheikh Wunnam - 02.07.2021 12:32

it is perfect.

Ответить
Easy Video T&T
Easy Video T&T - 30.06.2021 00:01

Hi Gio, do you have any paid courses?

Ответить