Managing project folder structure in PhpStorm

I would like to ask what is the best approach for creating folder structure in PhpStorm. Typical approach for project, which is using composer is:

/appName1
    /src
    /vendor
/www

where www is the root of the web server, so all important application files are outside www root, except "front controller" which is in the www root (usually in index.php). Of course in case of using composer I need to have following line in index.php:

require '../appName1/vendor/autoload.php';

This works fine on my local dev machine. The problem is on the remote server, where there are several different apps and therefore the structure is slightly different:

/Applications
    /appName1
        /src
        /vendor
    /appName2
        /src
        /vendor
/www

and the path is slightly different too, to include autoload.php:

require '../Applications/appName1/vendor/autoload.php';

So whenever I deploy the application on the remote server I need to remember to modify the path, which is very annoying. I was wondering whether PhpStorm offers some way to manage these paths automatically.

The solution could be also replicate the exact folder structure on my dev environment (so including Applications folder as root), but then I have problems when using composer in PhpStorm "Command Line Tools Console", as it expects that composer.json file is located in the project root. After adding additional folder level (Applications) this is not the case anymore and composer cant't find the json file.

 

0
1 comment

I believe you can download the site/application from a remote web server excluding folders that are not needed in a project.

I.e. for appName1 you download /Applications/appName1 excluding /Applications/appName2 and others.

This way you wouldn't have to edit composer & stuff.

0

Please sign in to leave a comment.