How to structure your Drupal repository
Learn how to properly structure your Drupal repository according to Acquia’s best practices.
The Acquia Way™ to structure your Drupal repository
There are many ways to organize your Drupal repository. At Acquia, we have a preferred structure that will make your development efficient and your application easy to maintain (e.g., with Composer). It will also ensure that your application is fully compatible with all Acquia products.
If you’re starting a new project, we recommend using one of our starting templates. Our best practices (e.g., Composer configuration,
.gitignore values, etc.) are already baked-in.
Otherwise, follow the guidelines listed below to ensure that your existing application is structured according to our recommendations.
To be hostable on Acquia Cloud Platform
There are a few “bare minimum” requirements for your Drupal application to function on the Acquia Cloud Platform:
- Your Drupal root (where Drupal Core’s index.php is located) must be located in a directory named
settings.php file must include an Acquia require line
[info block] if you’re using Acquia BLT, this is done for you automatically.
To be manageable with Composer
When Drupal 8 was released in 2015, Composer became the way to manage dependencies for your Drupal applications (or any PHP application for that matter).
As with any framework, there are some framework-specific conventions that should be followed. Drupal is no different in that regard. In the Drupal community, we sometimes call those “Drupalisms.”
In order to make your application easy to manage via Composer, you should follow these conventions:
composer.lock files must be in the root directory. I.e., not in a subdirectory like
composer.lock files should be committed via git (not gitignored). This is a well established best practice for Composer.
- Your composer file should include Drupal specific configuration. At a minimum, it should:
To be compatible with Acquia Code Studio