Search code examples
phpcomposer-phprestler

Composer - Mapping the src directory to the document root with the vendor folder outside


I have the following folder structure.

src/
  |- index.php
test/
vendor/
composer.json
composer.lock

When i want to deploy my code, I realize that i have to map the src/ directory to document root since it contains the index.php file (which btw contains some Restler code) However, if i do that, how do i deal with the vendor/ folder that lies outside the document root?


Solution

  • vendor folder MUST be outside of the web root for better security

    When you include autoload.php or restler.php, it will take care of making those classes (residing in vendor folder) available

    Ideally you should keep your index.php in a folder named public and use src folder for keeping your own code