Call me crazy, but this was clear, concise and staightforward. You could easily split this up into separate files, would have to revise some of the potential vulnerabilities - et voilà, a performant, state-of-the-art app. No mixing of frontend, backend, no mashup of code, markup and styling the way React (including Next Js) and the like do. Didn't really have to stop the video at any point, since everything was so refreshingly self-explanatory. I SO wish knowledge of core web functionalities could still land me a job in 2024. Oh well, go ahead, crucify me
This was very much how you would write PHP way back in the days. Simple and quick to do, but becomes quickly hard to maintain when your application grows. Stuff like this haunts me in my dreams haha. Anyways, great video!
I did that in my final exam, I broke them up in different files and require_once them but it was one procedual block of code executed under the same index.php :D
@@xorxpert In a professional setting, yes. Your hobby project that you won't finish and just wanna MVP? no. It all depends on the circumstances around what you are building.
The frameworks mostly add quick ways of doing things, but at the cost of code you don't understand or even know exists. The years of developing the core PHP have given us tools to build real sites easily. Yes, you could do all of your sites in one file, but breaking it into a few small files isn't bad either if you stick to the lower-level built-in tools. I have a PHP framework that worked out with minimal extra code I didn't write, which gave me a lot of flexibility, and it works now 10 years later.
I'm a database guy who sometimes has to create CRUD apps for internal users. This approach suits me just fine. In fact, it solidifies my thinking that the app supports the database and not the other way around. They are no different than my ETL scripts in that a UI is still a interface my data integrates with.
A couple of area's you can fastly improve the readability of this is to abstract certain functionality away into functions. Which you can collapse in your editor. This can even be done with the HTML. To echo your HTML, if I remember it correctly you simple open the close the PHP brackets, write HTML and open the HTML brackets again at the end of the function. Additionally I would create use environment variables, and create a function to get the DB connection, where it lazy loads the connection. This will ensure only a DB connection is created when it's needed.
Please create a vídeo, applying a some refactor startegy, with some problems or include a new feature, will be a great video to teach "why refactor?" Great video
Love this video! It may not be optimal, but starting a project as a single giant php file helps me focus on the actual logic of the application. Then while I write, I can optimize redundant and unsafe code only when it makes sense to do so, instead of adopting solutions and paradigms just for the sake of it.
It looks like the web dev industry is undergoing a moment of deep reflection. Many devs are beginning to realize that most of the products they ship are over engineered, have unnecessary complexities and that we have tools that have less hype yet can deliver just as good as the tools they were introduced to in their bootcamps (oh yes some of these shiny tools are the product of Bootcamps that teach you that Language X/Library X/Framework X is the one and only true way to build applications.)
Yep! I been in this thing from the start in the mid-90s. It's like this for real... 1995, 1996, 1997, 2022, 2023, 2024. Once HTMX-like functionality is added to the browser web development shall be fun and free again. Till then, just add HTMX and free your mind and time. Exercise and sleep more!
Single file php is going too far in the other direction. Splitting routes into separate files is a big boost for readability at almost no cost I dev time.
All of that assumes that what you see in this video is an actual good idea, which it isn't. All of the people talking about "bloated overengineered node_modules wtfjs" fail to realize that there is no difference between engineering and overengineering. The real enemy is underengineering, with which you get insecure protocols like SS7 and BGP, incomplete languages like JS and PHP, and bad programmers thinking "no frameworks/dependencies" is something you should be proud of.
@@okie9025 The web has existed longer than these frameworks and dependencies that people worship. In fact more and more developers are beginning to question the "accepted" way of doing things. And thanks to AI when anybody with a brain will be able to build a web application, these libraries, frameworks and tools that you all worship will now be what they are supposed to be; just tools.
@@pythonantole9892 I'm not sure where you get this notion of people "worshipping" tools. They've always been tools, nobody is saying otherwise. I've seen this with "no-framework" purists before; they think there is some sort of webdev cult where people purposefully hurt themselves by using slow and complicated frameworks simply for the lols, then complain to others why they're not doing the same. I've never seen what these people often say is practically every web developer. In my experience, the only delusional people are the aforementioned purists, which would rather break a leg reinventing the wheel than install a single dependency. There are legitimate reasons not to use dependencies or the newest frameworks, but rose tinted glasses or imagined supremacy are not it.
This brings me back to how I wrote many apps in PHP, lol. Great reminder of how many abstracts we now have with all the web frameworks. Fun watching this and building out my own single page php app again!!! Thank you for the flashback ;)
Thanks for this video! Just getting into React Native, at my fourth semester as a Software Engineer. I love videos as these that goes into explaining new upcoming stuff that may become relevant at some point!
I do things like this all the time. It is all about the data that is being passed. Going the straight PHP and vanilla javascript way improved how I maintain code through how to structure everything.
I've personally never used PHP. But seeing how easy it was to create an entire coffee shop application in literally ONE file, with hot reload and a ton for standard functions, I think I might use PHP for future little projects :P
The best way to learn web development as a beginner is rhis way with PHP. No deep abstraction. After you can learn how to move some parts in order to make the code more maintainable and readable.
@@florisvandenberg7424 Also, contributing to existing frameworks. To get framework level understanding, it certainly helps to write one and use it for a few years on multiple projects (since reusability and modularity is fundamental to frameworks). With that foundational knowledge though, it enables you to better understand how to contribute to one as well. Or just start using an existing one immediately but get under the hood and figure out how it works; edit it, change it, see what works and what doesn't. 😁
If you are not doing single index.php currently and are not able to monetize, moving to developing this way won't change a thing. This is something that works for Pieter Levels, but changing the way you work won't give you automatic success. We all developped like this this 25 years ago, there are also big downsides to this. Nice video
The most cringey thing for me is this is 100% better than some stuff I probably wrote in the past! 😂 But I agree with your overall point -- this is a wonderful video that provides some much needed perspective.
Good video! Kudos to showing that the PHP is here to stay! You can also use object oriented classes, or use functions in an old procedural style, all in one index.php
Great video and commentary. Built my first app a few years ago using plain vanilla php and bootstrap and it worked great, then somehow i got convinced it was badly written (well it kind of was really), but instead of improving the existing code i completely dumped it and rewrote it from scratch using Laravel (and tailwind). The rewrite works great, but i wish i havent turned to Laravel or any other framework. The code is now harder to understand, too much "magic" and opinionated ways kind of takes the fun of coding for me. It also introduced to me the pain of keeping the framework and its dependencies updated. I kind of dislike working on that code, same with other frameworks such as Django.
But with a small amount of work, almost all of that inconvenience is eliminated. You can easily split this into separate files for each view or route and simply rely on the web server for routing. Or you can build your own router. I mean, you can even build your own router in a single-file site like this.
Nobody says that it isn't possible. For very small Websites it might even be a reasonable approach. The problems arise when the site becomes bigger and bigger with ever more features and a dev team of 30 working on it. A single php file becomes completely unmaintainable at that point.
I checked out the repo on his github (orl-coffee) and this is definitely a "build it and forget it" sort of project, lol. Maintaining this would be a nightmare without a little abstraction. For example: Client may ask to change location to separate fields so we can perform zip code validation. That single "location" field is spread out in multiple spots and you have to manually deduplicate that from the header responses (also in the same monolithic file) which use the "Location: ..." header. Now take that and multiply that many times over _and_ spread that out over multiple years (as you forget how you originally built it) and/or multiple developers with differing approaches to things or a similar lack of understanding to the original approach.
This can be good and *way* easier to read and navigate if you extract all the HTML files out and use file_get_contents instead. Wouldn't be a single file anymore but much more maintainable.
Abstract the views to simple .php files and use include/require statements. PHP itself is a templating language and you can pretty easily implement a simple MVC-style app this way (that was what we did decades ago).
@@patricknelson Why .php files? I've found it easier to use HTML files, while doing all the PHP logic in the main PHP file. If you're suggesting that all the templating stuff be done alongside the HTML, that's a bit oldskool, hard to read and difficult to work with. Much better to separate PHP and HTML 100% IMO
You know what you can also do? Serve an angular application from a php page. Make your server view the index.html as a php file and have htaccess for permissions. Used to use this method to serve angular full stack applications.
Wait a second. at about 3:30. how is this any different from Next.js' page.js and React's jsx? it's exactly the same thing! it's like after years of innovation Next.js just reinvented php?!
I think your video is kinda dangerous. Making a tutorial about an application in vanilla is fine, as long you don't omit basic security. There are many beginners out there who don't know about XSS and SQL-Injections and will follow along this style of writing code.
Exactly. This is fine for a side project or if you are going to be the only developer. Its maybe even preferred! Fancy frameworks and design patterns come into play when you want to scale the project such that an entire team or organization can work on it. I think people misunderstand this. Especially the scalability part (it's more about enabling multiple developers to work concurrently, than performance). That said, it's also fine to use overkill design patterns and frameworks on your side project, if the goal is learning for your main job.
I'm starting with php and find this quite insteressting since there are a ton of frameworks which are kinda overwhelming for me as a starter! Can somebody name the theme/font which is used in this video? :)
Hi, thanks for the video. However, i also watched that interview, i dont think that he means literal single index.php. If he did that way i dont believed. Because for example, you omit, or at least i did not catch, how you apply the mode rewrite, even you indicate the document root, Or are you using ngnix for redirect all the traffic for index.php without a need of htacces in of apache server? All frameworks point out all traffic to a single public index. And like i read in the comment, at least use PDO, which exist since PHP 5.1 with prepare statements and naming placeholders to avoid sql injection. To validate if is a int you should use filters of type validate ( dont mix up with filterss for sanitize) for that, because is_numeric is not reliable not even is_int and even to other kind validation. No need for list function, just use similar to js, just see the syntax on official docs. Please use short echo and with escape html. That global keyword is killing me 🤣 And to finished dont forget csrf token. 😱 Because of videos like this that people make fun of it. 🤧
this only works if you redirect all routes to index.php, if such directory or file doesn’t exist. this is how i create single/dynamic pages with apache
I have a 35000 line php file from 2010 that's a fully working comnersally sold back then CMS system and site thiscwas the first thing I build for someone else bad times but it worked
How do you have a single php file being accessed from multiple paths/URIs? I guess another way of asking that is what is the webserver that would be used to run this? I'm really only familiar with apache where the URI represents the literal file path on the server.
This only good if you are working for your own project/startups. This didnt work in company i guess. I use to enjoy this type of coding back days with some spaghetti code, mixing functions , client code, and everything, this is what PHP are good for.
so you said don't worry about anything to connect but this is very hard to follow if I don't know how you did what you did to make the php working. Use just said a docker I know but I am not following that or know how to use it
I have Recently Worked on a Similar Kind Of Project in Php For My Amazon Affiliate Pages. it's Cool website but do you mind sharing the source code of this i would like to make similar Demos and Improve myself
the only thing, I don't know if it changed during the years, but if you don't put the DOCTYPE as first line of the file, it will pick another one that is defaul for the browser, I think XHTML 1.0 or 1.1
I see doctype farther down. Presumably, the result that is rendered and sent to the user has it at the top? (Remember, PHP is processed on the server, it isn't on the user's browser)
Have you tried PHPStorm with Laravel Idea? Pretty good. Otherwise Laravel just announced their new VSCode extension, which means only needing one as opposed to several.
the true single page application.
biblical accurate single page application
"We got single page at home"
single file application
@Ryan-gf1sz This! Because in One file, we have Many Pages! ☺☺☺
This brings me back. This was the cool way to write PHP 20 years ago.
Facts 20 years ago this a whhole vibe lol, in 2024 thoughhhh, eye twitching lol
OMG yes I was 10 coding a PHP Javascript and MySql site from the ground up 💪
This was the only way I knew how to do it in 2013 🤣
20 years ago? I did the same thing in 2015 :v
@@lamontevlogs why? because it looks cheap?
Call me crazy, but this was clear, concise and staightforward.
You could easily split this up into separate files, would have to revise some of the potential vulnerabilities - et voilà, a performant, state-of-the-art app.
No mixing of frontend, backend, no mashup of code, markup and styling the way React (including Next Js) and the like do.
Didn't really have to stop the video at any point, since everything was so refreshingly self-explanatory. I SO wish knowledge of core web functionalities could still land me a job in 2024.
Oh well, go ahead, crucify me
You ain’t crazy. This guy’s code is far more readable than many trending frameworks’ codebase.
This was very much how you would write PHP way back in the days. Simple and quick to do, but becomes quickly hard to maintain when your application grows. Stuff like this haunts me in my dreams haha. Anyways, great video!
@@offskip_dave Skill issue. You failed at implementing proper page routing.
if you actually coded this way in the example video, you’re a horrible PHP dev
I did that in my final exam, I broke them up in different files and require_once them but it was one procedual block of code executed under the same index.php :D
@@xorxpert In a professional setting, yes. Your hobby project that you won't finish and just wanna MVP? no. It all depends on the circumstances around what you are building.
As someone who didn't really use php ever, this code looks very straightforwars and simple.
Loved it. Today we have more tools and it's easier to start but harder to finish.
The frameworks mostly add quick ways of doing things, but at the cost of code you don't understand or even know exists. The years of developing the core PHP have given us tools to build real sites easily. Yes, you could do all of your sites in one file, but breaking it into a few small files isn't bad either if you stick to the lower-level built-in tools. I have a PHP framework that worked out with minimal extra code I didn't write, which gave me a lot of flexibility, and it works now 10 years later.
I'm a database guy who sometimes has to create CRUD apps for internal users. This approach suits me just fine. In fact, it solidifies my thinking that the app supports the database and not the other way around. They are no different than my ETL scripts in that a UI is still a interface my data integrates with.
A couple of area's you can fastly improve the readability of this is to abstract certain functionality away into functions. Which you can collapse in your editor. This can even be done with the HTML. To echo your HTML, if I remember it correctly you simple open the close the PHP brackets, write HTML and open the HTML brackets again at the end of the function.
Additionally I would create use environment variables, and create a function to get the DB connection, where it lazy loads the connection. This will ensure only a DB connection is created when it's needed.
Please create a vídeo, applying a some refactor startegy, with some problems or include a new feature, will be a great video to teach "why refactor?"
Great video
Love this idea.
Unfortunately I think one of the first things that will need to be done is to split the file into multiple files lol
28:46, an actual good point that i really appreciate you have mentioned.
Loved the video 💜
Good old days, PHP is still one of my favorites 🎉 good content of course.
Love this video! It may not be optimal, but starting a project as a single giant php file helps me focus on the actual logic of the application. Then while I write, I can optimize redundant and unsafe code only when it makes sense to do so, instead of adopting solutions and paradigms just for the sake of it.
It looks like the web dev industry is undergoing a moment of deep reflection. Many devs are beginning to realize that most of the products they ship are over engineered, have unnecessary complexities and that we have tools that have less hype yet can deliver just as good as the tools they were introduced to in their bootcamps (oh yes some of these shiny tools are the product of Bootcamps that teach you that Language X/Library X/Framework X is the one and only true way to build applications.)
Yep! I been in this thing from the start in the mid-90s. It's like this for real... 1995, 1996, 1997, 2022, 2023, 2024.
Once HTMX-like functionality is added to the browser web development shall be fun and free again. Till then, just add HTMX and free your mind and time. Exercise and sleep more!
Single file php is going too far in the other direction. Splitting routes into separate files is a big boost for readability at almost no cost I dev time.
All of that assumes that what you see in this video is an actual good idea, which it isn't. All of the people talking about "bloated overengineered node_modules wtfjs" fail to realize that there is no difference between engineering and overengineering. The real enemy is underengineering, with which you get insecure protocols like SS7 and BGP, incomplete languages like JS and PHP, and bad programmers thinking "no frameworks/dependencies" is something you should be proud of.
@@okie9025 The web has existed longer than these frameworks and dependencies that people worship. In fact more and more developers are beginning to question the "accepted" way of doing things. And thanks to AI when anybody with a brain will be able to build a web application, these libraries, frameworks and tools that you all worship will now be what they are supposed to be; just tools.
@@pythonantole9892 I'm not sure where you get this notion of people "worshipping" tools. They've always been tools, nobody is saying otherwise. I've seen this with "no-framework" purists before; they think there is some sort of webdev cult where people purposefully hurt themselves by using slow and complicated frameworks simply for the lols, then complain to others why they're not doing the same. I've never seen what these people often say is practically every web developer. In my experience, the only delusional people are the aforementioned purists, which would rather break a leg reinventing the wheel than install a single dependency. There are legitimate reasons not to use dependencies or the newest frameworks, but rose tinted glasses or imagined supremacy are not it.
Had no idea i could write php this way, now im gonna create my websites more easily and less chaos over the files
This brings me back to how I wrote many apps in PHP, lol. Great reminder of how many abstracts we now have with all the web frameworks. Fun watching this and building out my own single page php app again!!! Thank you for the flashback ;)
Thanks for this video! Just getting into React Native, at my fourth semester as a Software Engineer. I love videos as these that goes into explaining new upcoming stuff that may become relevant at some point!
I do things like this all the time. It is all about the data that is being passed. Going the straight PHP and vanilla javascript way improved how I maintain code through how to structure everything.
I've personally never used PHP. But seeing how easy it was to create an entire coffee shop application in literally ONE file, with hot reload and a ton for standard functions, I think I might use PHP for future little projects :P
The best way to learn web development as a beginner is rhis way with PHP. No deep abstraction. After you can learn how to move some parts in order to make the code more maintainable and readable.
Then write your own framework. I learned a lot about how frameworks work by creating one.
@@florisvandenberg7424 Also, contributing to existing frameworks. To get framework level understanding, it certainly helps to write one and use it for a few years on multiple projects (since reusability and modularity is fundamental to frameworks). With that foundational knowledge though, it enables you to better understand how to contribute to one as well. Or just start using an existing one immediately but get under the hood and figure out how it works; edit it, change it, see what works and what doesn't. 😁
Taking monolithic apps to a new level
If you are not doing single index.php currently and are not able to monetize, moving to developing this way won't change a thing. This is something that works for Pieter Levels, but changing the way you work won't give you automatic success. We all developped like this this 25 years ago, there are also big downsides to this. Nice video
The most cringey thing for me is this is 100% better than some stuff I probably wrote in the past! 😂 But I agree with your overall point -- this is a wonderful video that provides some much needed perspective.
Does anyone know what font he is using in his editor? It feels easy on the eyes.
comic mono
Good video! Kudos to showing that the PHP is here to stay!
You can also use object oriented classes, or use functions in an old procedural style, all in one index.php
This was amazing to watch. Would love to see more of these single page PHP apps. Thank you so much for making this.
Reminds me of my PHP websites in my web development intro class in university lol, I'm glad we've all advanced past this.
Great video and commentary. Built my first app a few years ago using plain vanilla php and bootstrap and it worked great, then somehow i got convinced it was badly written (well it kind of was really), but instead of improving the existing code i completely dumped it and rewrote it from scratch using Laravel (and tailwind). The rewrite works great, but i wish i havent turned to Laravel or any other framework. The code is now harder to understand, too much "magic" and opinionated ways kind of takes the fun of coding for me. It also introduced to me the pain of keeping the framework and its dependencies updated. I kind of dislike working on that code, same with other frameworks such as Django.
It’s like the PHP version of trying out a flip phone in 2024. It’s a nice nostalgia trip but it gets very inconvenient really really fast 😅
for 65k a month i dont care
But with a small amount of work, almost all of that inconvenience is eliminated. You can easily split this into separate files for each view or route and simply rely on the web server for routing. Or you can build your own router. I mean, you can even build your own router in a single-file site like this.
@@alexandrepellegrino2699 fair
@@haphazard1342 not gonna lie. I kinda want to do this myself. Just to see how spoiled I’ve become with all this Laravel goodness
For me it's fine. My site only gets 200 users max a year. lol
Remembering the old days.
Nobody says that it isn't possible. For very small Websites it might even be a reasonable approach. The problems arise when the site becomes bigger and bigger with ever more features and a dev team of 30 working on it. A single php file becomes completely unmaintainable at that point.
I checked out the repo on his github (orl-coffee) and this is definitely a "build it and forget it" sort of project, lol. Maintaining this would be a nightmare without a little abstraction. For example: Client may ask to change location to separate fields so we can perform zip code validation. That single "location" field is spread out in multiple spots and you have to manually deduplicate that from the header responses (also in the same monolithic file) which use the "Location: ..." header. Now take that and multiply that many times over _and_ spread that out over multiple years (as you forget how you originally built it) and/or multiple developers with differing approaches to things or a similar lack of understanding to the original approach.
is it just me ( laravel beginner ) or writing vanilla php is drastically different from writing laravel code ? fantastic job btw man
In the Laravel world, you write Laravel not PHP lol.
Yea framworks for php are mostly Object-Oriented Programming
Laravel is mostly object-oriented so it is different, but you can add complexity if you need it in plain PHP and make it as abstract as Laravel.
The only thing about the code you show is that it is so easy for users to gain access to the admin panel through very simple SQL injection.
This can be good and *way* easier to read and navigate if you extract all the HTML files out and use file_get_contents instead. Wouldn't be a single file anymore but much more maintainable.
Abstract the views to simple .php files and use include/require statements. PHP itself is a templating language and you can pretty easily implement a simple MVC-style app this way (that was what we did decades ago).
@@patricknelson Why .php files? I've found it easier to use HTML files, while doing all the PHP logic in the main PHP file. If you're suggesting that all the templating stuff be done alongside the HTML, that's a bit oldskool, hard to read and difficult to work with. Much better to separate PHP and HTML 100% IMO
The good old days, really cool video ❤
Hey man! Love the video, just one question (out of curiosity), how long did it take you to go from start to finish in this project?
You know what you can also do? Serve an angular application from a php page. Make your server view the index.html as a php file and have htaccess for permissions. Used to use this method to serve angular full stack applications.
I am an avid hater of PHP but this makes me realize why it caught on. So easy to understand. Weird, but simple
github link?
I think its at aschmelyun orl-coffee
The HTML doesn't seem to be written very semantically?
See that come to head in JS frameworks too. Semantics is aside to the main idea of this video.
footer 😜
@@Jabberwockybirdi see what you did there?
idk php yet but this video was extremely educational for some reason
Please can you do a video starting php using docker for those of us using ubuntu
Wait a second. at about 3:30. how is this any different from Next.js' page.js and React's jsx? it's exactly the same thing! it's like after years of innovation Next.js just reinvented php?!
yep
Yeah lmao, it comes full circle
components lol?
Ufff, old times, , why do not using PDO ?
Old school as u said 😁
If you’re always going to use MySQL, why not?
mysqli is god send
Can you help with the docker setup or maybe a GitHub link with the source code?
Which font is this?
PHP is beautiful. Simple code is beautiful. Just embrace it and keep it simple.
I'm pretty sure Futaba Channel did this, right?
We used to call this ‘spaghetti code’. Fine for a very small site. Very challenging to maintain otherwise.
I think your video is kinda dangerous. Making a tutorial about an application in vanilla is fine, as long you don't omit basic security. There are many beginners out there who don't know about XSS and SQL-Injections and will follow along this style of writing code.
Nice! Any chance to have a link to the source code please. I admire the simple integration of tailwind too. Thanks
Exactly. This is fine for a side project or if you are going to be the only developer. Its maybe even preferred!
Fancy frameworks and design patterns come into play when you want to scale the project such that an entire team or organization can work on it. I think people misunderstand this. Especially the scalability part (it's more about enabling multiple developers to work concurrently, than performance).
That said, it's also fine to use overkill design patterns and frameworks on your side project, if the goal is learning for your main job.
I like this for sure. Subscribed. would it be hard to make a PDO version of this? :)
Hey it’s really super, like this is that possible to build a multiple route API Using Php , kindly create a video in it if possible, thank you
Nice video. Could u please tell me what font you u in this video?
lovely. I don't know why people are scared of beginners making mistakes. that's how you learn.
I'm starting with php and find this quite insteressting since there are a ton of frameworks which are kinda overwhelming for me as a starter!
Can somebody name the theme/font which is used in this video? :)
Hi, thanks for the video.
However, i also watched that interview, i dont think that he means literal single index.php. If he did that way i dont believed. Because for example, you omit, or at least i did not catch, how you apply the mode rewrite, even you indicate the document root, Or are you using ngnix for redirect all the traffic for index.php without a need of htacces in of apache server?
All frameworks point out all traffic to a single public index.
And like i read in the comment, at least use PDO, which exist since PHP 5.1 with prepare statements and naming placeholders to avoid sql injection.
To validate if is a int you should use filters of type validate ( dont mix up with filterss for sanitize) for that, because is_numeric is not reliable not even is_int and even to other kind validation. No need for list function, just use similar to js, just see the syntax on official docs.
Please use short echo and with escape html. That global keyword is killing me 🤣
And to finished dont forget csrf token. 😱
Because of videos like this that people make fun of it. 🤧
Amazing video, subbed!
this only works if you redirect all routes to index.php, if such directory or file doesn’t exist. this is how i create single/dynamic pages with apache
I was just about to say that - this can't be done with a single index.php file, a .htaccess file is also needed for the routing
I have a 35000 line php file from 2010 that's a fully working comnersally sold back then CMS system and site thiscwas the first thing I build for someone else bad times but it worked
Back to the old days👍
even though its clearly not very practical, I still think this is a cool thing to try 😋
Your basic app + production + marketing == $1000/m company ❤💯
Please share code / github link pleaseee
your video opened my mind :)
i guess php is not as bad as it seems like!
Yeah, where is the repository? Is it hosted somewhere? 💻👨💻
That's what i normally use Python-Flask for single page web app for some prototype or demo.
do you guys see any issue combining this with htmx?
nice video, but what is that vscode theme name ?
How do you have a single php file being accessed from multiple paths/URIs? I guess another way of asking that is what is the webserver that would be used to run this? I'm really only familiar with apache where the URI represents the literal file path on the server.
look into .htaccess
Read about mod_rewrite in Apache
@@TheKris2X gracias
@@elijahbuscho7715If you’re using apache, there’s a simple re-write rule.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?path=$1 [NC,L,QSA]
This only good if you are working for your own project/startups. This didnt work in company i guess. I use to enjoy this type of coding back days with some spaghetti code, mixing functions , client code, and everything, this is what PHP are good for.
Hey, can I get this code for study
Great work. Retro style ))). But really educative
is there somewhere to download this index.php ?
so you said don't worry about anything to connect but this is very hard to follow if I don't know how you did what you did to make the php working. Use just said a docker I know but I am not following that or know how to use it
This is THE way I create applications. I hate many files, I merge everything I possibly can into 1 file.
Clearly it can be done but should it?
isnt it 2 files if you used a seprate css file????
Wich vscode thmeare you using?
Are you using tailwind?
What is your font name?
I have Recently Worked on a Similar Kind Of Project in Php For My Amazon Affiliate Pages. it's Cool website but do you mind sharing the source code of this i would like to make similar Demos and Improve myself
I'll just say this: "Silence is golden". If you know you know lol
The key in Silence undetected.
--National Treasure
font you use in vscode?
Is it secured?
the only thing, I don't know if it changed during the years, but if you don't put the DOCTYPE as first line of the file, it will pick another one that is defaul for the browser, I think XHTML 1.0 or 1.1
I see doctype farther down. Presumably, the result that is rendered and sent to the user has it at the top? (Remember, PHP is processed on the server, it isn't on the user's browser)
@@Jabberwockybird I used to program in php, that's why I'm saying, I have a feeling it well end up rendering it not at the top
Everybody goes back to Vanilla at some point. 🍦
you using the same background as i do confused me so much LOL
I wish you'd used PDO and not mysqli_ functions.
Nothing wrong with mysqli.
I’ve been to all of those coffee shops. Orlando local 😅
Wow I’m back in 2003 ! Good Ol’ Times 😂
Why dont use oop inside that index.php?
It is a MVP
@@tonybengue so you can' use best practices if its MVP?😮💨
@@mr.valdez8430 You do what you want as a developer. MVP stands for Minimum Viable Product. If you want to code a whole framework for an MVP, do it.
@@mr.valdez8430”best practices” according to whom? There are other paradigms.
He doesn't want to make Php OOP for obvious reasons
what is the theme name?
what is it with the font ? 💀
Goodie old days🎉
if you are the only one who knows about the security issues. does it really matter?
This is how I wrote my PHP back then.
When we first created PHP scripts, we wrote everything in an intex file! Old tricks again in new times.
Can you do a video showing how you setup VsCode for PHP/Laravel development?
Showing extensions and configurations.
great idea, I need this. my editor is bloated with extensions that do the same thing 😅. time to purge them and start over
@@AbderrahmanFodiliInstall just laravel extensions and you’re done.
steps:
1. You go buy PhpStorm
2. you install the free laravel extension
3. (optional) You buy laravel Idea extension
Have you tried PHPStorm with Laravel Idea? Pretty good.
Otherwise Laravel just announced their new VSCode extension, which means only needing one as opposed to several.
@@scott_itall8638 I do have a PHPStorm license with the Idea plugin, its really good.