Iniciar proyecto Drupal 8 con Composer

Por admin-dayscript, 4 Septiembre, 2018

Instalar Drupal composer init global

$ composer global require hussainweb/drupal-composer-init

En un directorio nuevo ejecutar composer drupal-init para crear el archivo composer.json

$ composer drupal-init

Welcome to the Drupal Composer config generator

This command will guide you through creating your composer.json config for a Drupal setup.

Package name (<vendor>/<name>) [dayscript/drupal-learning]: dayscript/drupal-learning

Description []:

Author [dayscript <soporte@dayscript.com>, n to skip]:

Minimum Stability [dev]:

License []:

Public web directory [web]:

Drupal core or distribution [drupal/core]:

Version for drupal/core [^8.5]:

En esta parte podemos agregar modulos al archivo composer.json

Define your dependencies. Would you like to define your dependencies (require) now [yes]?
Search for a package: [devel]
Found 65 packages matching devel

[0] drupal/devel [1] drupal/devel_debug_log [2] drupal/config_devel [3] drupal/devel_mail_logger [4] drupal/devel_generate_plus [5] drupal/devel_clipboard [6] drupal/devel_codemirror [7] drupal/devel_ladybug [8] drupal/devel_mode [9] drupal/migrate_devel

Enter package # to add, or the complete package name if it is not listed: 8

Enter the version constraint to require (or leave blank to use the latest version):

Si hemos terminado de definir los modulos a usar oprimimos enter

Search for a package: Would you like to define your dev dependencies (require-dev) now [yes]? Search for a package:

Finalmente nos mostrara como quedaria nuestro archivo composer.json

{ "name": "ariel/drupal-learning", "type": "project", "require": { "cweagans/composer-patches": "^1.6.0", "hussainweb/drupal-composer-helper": "^1.0", "drupal/core": "^8.5", "drupal/console": "^1.0.2", "drush/drush": "~8.0|^9.0.0-beta8", "drupal/devel": "^1.2", "drupal/taxonomy_menu": "^3.3", "drupal/zurb_foundation": "^5.0@beta" }, "require-dev": { "behat/mink": "~1.7", "behat/mink-goutte-driver": "~1.2", "jcalderonzumba/gastonjs": "~1.0.2", "jcalderonzumba/mink-phantomjs-driver": "~0.3.1", "mikey179/vfsstream": "~1.2", "phpunit/phpunit": ">=4.8.28 <5", "symfony/css-selector": "~2.8" }, "authors": [ { "name": "aacevedoday", "email": "aacevedo@dayscript.com" } ], "repositories": [ { "type": "composer", "url": "https://packages.drupal.org/8" } ], "minimum-stability": "dev" }

Oprimimos enter para confirmar que estamos de acuerdo

Do you confirm generation [yes]?

Para descargar iniciar la instalacion ejecutar

$ composer install

Si se nos olvido instalar algun paquete, podemos agregarlo con:

$ composer require drupal/devel

$ composer require drupal/zurb_foundation

$ composer require drupal/[module]

Comentarios