2017 © Pedro Peláez
 

project project

Project template for Drupal 8 projects with composer

image

drupaljedi/project

Project template for Drupal 8 projects with composer

  • Saturday, November 4, 2017
  • by drupaljedi
  • Repository
  • 3 Watchers
  • 2 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 536 Forks
  • 2 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Composer template for Drupal projects

Build Status Total Downloads, (*1)

This project template should provide a kickstart for managing your site dependencies with Composer., (*2)

Usage

  1. Install composer.
  2. Create the project : composer create-project drupaljedi/project project_name --stability dev --no-interaction
  3. Execute the ./tools/scripts/before-install.sh project_name command to prepare project for installation.
  4. Run docker containers: cd provision/local && docker-compose up -d && cd -
  5. Install Drupal: ./tools/scripts/install.sh

With composer require ... you can download new dependencies to your installation., (*3)

cd project_name
composer require drupal/be_sure

The composer create-project command passes ownership of all files to the project that is created. You should create a new git repository, and commit all files not excluded by the .gitignore file., (*4)

What does the template do?

When installing the given composer.json some tasks are taken care of:, (*5)

  • Drupal will be installed in the docroot-directory.
  • Autoloader is implemented to use the generated composer autoloader in vendor/autoload.php, instead of the one provided by Drupal (drupal/vendor/autoload.php).
  • Modules (packages of type drupal-module) will be placed in docroot/modules/contrib/
  • Theme (packages of type drupal-theme) will be placed in docroot/themes/contrib/
  • Profiles (packages of type drupal-profile) will be placed in docroot/profiles/contrib/

Updating Drupal Core

This project will attempt to keep all of your Drupal Core files up-to-date; the project drupal-composer/drupal-scaffold is used to ensure that your scaffold files are updated every time drupal/core is updated. If you customize any of the "scaffolding" files (commonly .htaccess), you may need to merge conflicts if any of your modified files are updated in a new release of Drupal core., (*6)

Follow the steps below to update your core files., (*7)

  1. Run composer update to update Drupal core, contrib modules and its dependencies.
  2. Run git diff to determine if any of the scaffolding files have changed. Review the files for any changes and restore any customizations to .htaccess or robots.txt.
  3. Commit everything all together in a single commit, so docroot will remain in sync with the core when checking out branches or running git bisect.

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., (*8)

Should I commit the scaffolding files?

The drupal-scaffold plugin can download the scaffold files (like index.php, update.php, …) to the docroot/ directory of your project. If you have not customized those files you could choose to not check them into your version control system (e.g. git). If that is the case for your project it might be convenient to automatically run the drupal-scaffold plugin after every install or update of your project. You can achieve that by registering @drupal-scaffold as post-install and post-update command in your composer.json:, (*9)

"scripts": {
    "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
    "post-install-cmd": [
        "@drupal-scaffold",
        "..."
    ],
    "post-update-cmd": [
        "@drupal-scaffold",
        "..."
    ]
},

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., (*10)

To add a patch to drupal module foobar insert the patches section in the extra section of composer.json:, (*11)

"extra": {
    "patches": {
        "drupal/foobar": {
            "Patch description": "URL to patch"
        }
    }
}

The Versions

04/11 2017

8.x-dev

8.9999999.9999999.9999999-dev

Project template for Drupal 8 projects with composer

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

16/07 2017

7.x-dev

7.9999999.9999999.9999999-dev

Composer template for Drupal projects

  Sources   Download

The Requires