Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Joseph Torres
Joseph Torres
6,282 Points

PHP Folder structure question!

Hello, I'm going to start my first php project and I just wanted to know a basic folder structure, nothing elaborate like MVC. I mean folders for includes, connection to mysql, and functions. Can someone point me in the right direction, Thank you.

1 Answer

jamesjones21
jamesjones21
9,260 Points

Hi Joseph,

A typical folder structure would look like:

Folders:
*src >
-inc
-classes
-config.php
*assets >
-img
-js
-css

The config.php file will act as the database connection, or if you are using OOP then you can put an autoloader into this file to include all classes that are in the classes folder. The inc folder is more toward procedural paradigm and will hold function files.

Hope this helps?

cheers, James