taoti / drupal-project
Builds a Drupal Project with development tools and our theme.
Requires
- composer/installers: ^1.0.20
- cweagans/composer-patches: ~1.0
- drupal/console: ^0.10.6
- drupal/core: 8.0.*
- drush/drush: ~8.0
Requires (Dev)
- behat/mink: ~1.6
- behat/mink-goutte-driver: ~1.2
- drupal/devel: 8.1.*
- jcalderonzumba/gastonjs: ^1.1@dev
- jcalderonzumba/mink-phantomjs-driver: dev-master#10d7c48c9a4129463052321b52450d98983c4332
- mikey179/vfsstream: ~1.2
- phpunit/phpunit: ~4.8
- symfony/css-selector: 2.7.*
Conflicts
README
This project template should provide a kickstart for managing your site dependencies with Composer.
If you want to know how to use it as replacement for Drush Make visit the Documentation on drupal.org.
Usage
First you need to install composer.
Note: The instructions below refer to the global composer installation. You might need to replace
composer
withphp composer.phar
(or similar) for your setup.
After that you can create the project:
composer create-project taoti/drupal-project:8.x-dev some-dir --stability dev --no-interaction
With composer require ...
you can download new dependencies to your installation.
cd some-dir
composer require drupal/devel:8.*
What does the template do?
When installing the given composer.json
some tasks are taken care of:
- Drupal will be installed in the
web
-directory. - Autoloader is implemented to use the generated composer autoloader in
vendor/autoload.php
, instead of the one provided by Drupal (web/vendor/autoload.php
). - Modules (packages of type
drupal-module
) will be placed inweb/modules/contrib/
- Theme (packages of type
drupal-theme
) will be placed inweb/themes/contrib/
- Profiles (packages of type
drupal-profile
) will be placed inweb/profiles/contrib/
- Creates default writable versions of
settings.php
andservices.yml
. - Creates
sites/default/files
-directory. - Latest version of drush is installed locally for use at
vendor/bin/drush
. - Latest version of DrupalConsole is installed locally for use at
vendor/bin/drupal
.
Updating Drupal Core
Updating Drupal core is a two-step process.
- Update the version number of
drupal/core
incomposer.json
. - Run
composer update drupal/core
. - Run
./scripts/drupal/update-scaffold [drush-version-spec]
to update files in theweb
directory, wheredrush-version-spec
is an optional identifier acceptable to Drush, e.g.drupal-8.0.x
ordrupal-8.1.x
, corresponding to the version you specified incomposer.json
. (Defaults todrupal-8
, the latest stable release.) Review the files for any changes and restore any customizations to.htaccess
orrobots.txt
. - Commit everything all together in a single commit, so
web
will remain in sync with thecore
when checking out branches or runninggit bisect
.
Generate composer.json from existing project
With using the "Composer Generate" drush extension
you can now generate a basic composer.json
file from an existing project. Note
that the generated composer.json
might differ from this project's file.
FAQ
Should I commit the contrib modules I download
Composer recommends no. They provide argumentation against but also workrounds if a project decides to do it anyway.
How can I apply patches to downloaded modules?
If you need to apply patches (depending on the project being modified, a pull request is often a better solution), you can do so with the composer-patches plugin.
To add a patch to drupal module foobar insert the patches section in the extra section of composer.json:
"extra": {
"patches": {
"drupal/foobar": {
"Patch description": "URL to patch"
}
}
}
What are the deployment steps?
Deployments have a few extra steps to get the correct library and dependency updates.
You can automate this by using Githooks
or your favorite deployment tool. An example of what the basic deployment steps are can be found
in scripts/deploy/deploy.sh
. The basic steps are as follows, the paths may change depending on environment:
cd /path/to/webroot/
- Use
ls
to check for the preseence of the./.vendor
directory. That means you are are the correct folder. composer install
Here is where you install/update your libraries.cd ./web/
now we go to the webroot run our rush commands. Drush may be installed on the device, but the safe version of drush to use will be the one packaged in with .vendor so we run drush like this:../vendor/bin/drush updb -y # run update.php ../vendor/bin/drush cr all # cache rebuild ../vendor/bin/drush cim git -y # configuration import ../vendor/bin/drush cr all # last cache rebuild