Jump to content

recommended file structure for PHP project


NotionCommotion

Recommended Posts

I for no particular reason typically use:

- myApplicationName
  - application/
    - classes/
    - components/ (from my start with Joomla, and I have a controller, model, view directory in each, however, I am thinking of moving away from)
    - includes/
    - lib/
      - js/
      - css/
      - images/
      - etc/
  - html/
    - index.php
    - lib/ (a symbolic link to ./application/lib
  - logs/
  - vendor/
  - composer.json (and lock, etc)
  - config.ini
  - httpd.conf, private.conf, etc if I include with my Apache setup.
  - readme

I've seen others that say:


- myApplicationName
  - src/
    - classes/
    - includes/
    - public/
      - index.php
    - logs/
    - vendor/
    - composer.json (and lock, etc)
    - config.ini

 Is there anything like a recommended file structure?

Link to comment
Share on other sites

Some people like "src" because that's traditional for compiled languages. It doesn't make as much sense for PHP, and particularly not when it's the only directory at that level.

 

Otherwise you've got the gist of it: public/html should be the web-accessible assets and a PHP script or two, then most everything else lives outside there. Separate classes/includes/lib/logs is good.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.