Creating a structure for your PHP code can be a headache if you have never done it before. I make a lot of simple websites so my folder structure will be pretty simple.
A folder that I use a lot is an “includes” folder . This includes folder will have my php files that I include into multiple pages . Some php file examples would be “head.php”, “header.php”, “footer.php”, “defines.php” and “init.php”.
The next folder that I would add would be an “images” folder. This folder is pretty self explanatory based on the name, you would add all of your images in here. If you won’t have any images then there is no need for this folder . Who are we kidding your always gonna have images or else your your site is gonna look very plain, at least that is my opinion. To each their own , right?
Now I will add a “css” folder . CSS just stands for Cascading Style Sheets. As I am sure you know what css files are used for , to style your web pages so they are pretty. Css files sure beats inline styling since if you change the style in your style sheet it will change all the pages that are connected with it , and if you just use inline styles you will have to update multiple places in each page to change the look of that page.
On to the “functions” folder. I will put all my function files in here . Function files just add features and functionality to your website. You just need to include or require these in the pages where you will need certain functions to take place.
And then you might need a “classes” folder. I will usually keep my database class file in the classes folder as well as other class files for more functionality. A class is basically a blueprint for an object .
Well that is my basic folder structure for when I make simple websites.
So to reiterate the folders that i use for a basic folder structure.