Skip to content

Instantly share code, notes, and snippets.

@frankyonnetti
Created May 25, 2021 20:03
Show Gist options
  • Save frankyonnetti/642240d2cc8db8f97a8a7f57e3beb8cc to your computer and use it in GitHub Desktop.
Save frankyonnetti/642240d2cc8db8f97a8a7f57e3beb8cc to your computer and use it in GitHub Desktop.
Drupal 8 composer #drupal #d8 #composer #Install

D8 installer page

/core/install.php

Use composer

https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies

Install Drupal

$ composer create-project --no-install drupal/recommended-project my_site_name_dir "^9.1"

  • edit composer.json to change "web-root" to use "htdocs/"
  • cd to new dir. $ composer install $ composer require drush/drush drupal/admin_toolbar $ vendor/bin/drush site:install

Check if updates are availiable:

$ composer update --dry-run "drupal/*"

Update core local:

$ composer update

Update on server

$ composer install

Update core other option:

$ composer update drupal/core --with-dependencies $ drush updb

exporting any new configurations

$ drush cex

to import use:

$ drush cim

clearing all caches

$ drush cr

composer memory errors

Allow composer to use the memory it needs. Not just the mem limited in the php.ini

alias composer='php -d memory_limit=-1 /usr/local/bin/composer $1'

$ COMPOSER_MEMORY_LIMIT=-1 composer [command]

install modules

$ composer require drupal/[project-name] $ drush en [project-name]

install module version

$ composer require drupal/<modulename>:<version> examples $ composer require drupal/token:1.x-dev

update modules

$ composer update drupal/[project-name]

uninstall module

$ drush pmu [project-name]

remove module

$ composer remove drupal/[project-name]


npm

eslint usage: $ npm install --g eslint $ npm install --g prettier $ npm install --g eslint-plugin-prettier


fix for composer update

https://www.drupal.org/forum/support/upgrading-drupal/2018-09-25/can-not-update-to-861-with-composer#comment-12816694 Remove the following and run composer update

  • vendor/
  • composer.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment