Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Drupal 8 Console & Composer #2342

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/config/sculpin_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,12 @@ contributors:
github: https://github.com/tessak22
avatar: //pantheon.io/sites/default/files/styles/540x540_top/public/JMP_9650-800x800.jpg
linkedin: http://linkedin.com/in/tessak22
alexfornuto:
name: Alex Fornuto
url: https://alexfornuto.com
avatar: //pantheon.io/sites/default/files/styles/540x540_top/public/Alex%20Fornuto.jpg
twitter: alexfornuto
gplus: https://plus.google.com/+AlexFornuto
github: https://github.com/alexfornuto
linkedin: https://www.linkedin.com/in/alexfornuto/
bio: Technical Content Editor for Pantheon.
26 changes: 25 additions & 1 deletion source/_docs/composer-drupal-8.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,31 @@ contributors:
- stevector
---

[Composer](https://getcomposer.org/) is a dependency management tool that allows PHP code to be more easily shared across projects. As Drupal 8 was written, many of its subsystems written specifically for Drupal were replaced by more widely used packages. For instance, Drupal's notoriously unwieldy function for making external requests, `drupal_http_request()`, [was replaced](https://www.drupal.org/node/1862446) by [Guzzle](http://guzzlephp.org/). Guzzle is included in Drupal 8 via Composer.
[Composer](https://getcomposer.org/) is a dependency management tool that allows PHP code to be more easily shared across projects. As Drupal 8 was written, many of its subsystems written specifically for Drupal were replaced by more widely used packages, using Composer. For example, Drupal's function for making external requests, `drupal_http_request()`, [was replaced](https://www.drupal.org/node/1862446) by [Guzzle](http://guzzlephp.org/). Guzzle is included in Drupal 8 via Composer.

## Caveats

As [discussed](#is-your-project-drupal-or-is-drupal-a-dependency-of-your-project%3F) in our FAQ below, The use of Composer to manage dependancies for both Drupal core _and_ custom development has raised some issues. This section covers known issues between the Composer methodology and the expected workflow on Pantheon.

If you're already familiar with Composer on Pantheon, you can move on to [Install Composer Locally](#install-composer-locally). Otherwise, read on.

### Workflow and Nested Docroot

Before using Composer to manage your site development you should choose a workflow. By default, Pantheon controls and distributes core updates via git commits, which can cause conflicts with files updated by Composer. Two common workflows around this issue are:

- Use Pantheon as a build environment, and managing development changes with an externally (or locally) hosted repository.

- Set a custom upstream (available to organizations), and manage core updates manually.

We suggest developers using Composer install their sites with the [Example Drops 8 Composer](https://github.com/pantheon-systems/example-drops-8-composer) repository, which moves Drupal to a "nested docroot". The repository README file covers the two common methods of deployment.

<div class="alert alert-info">
<h4 class="info">Note</h4><p markdown="1">
The methods described by the Example Drops 8 Composer repository replace the standard Drupal 8 upstream. By choosing this method, you become responsible for ensuring that your core remains up to date, per our [scope of support](/docs/getting-support/#scope-of-support)
</p>
</div>

If you'd instead prefer to the default Drupal 8 installation provided by Pantheon, the [Composer Merge Plugin](https://github.com/wikimedia/composer-merge-plugin), will parse multiple `composer.json` files into a single version when running updates. This method is the most likely to see merge conflicts, as core updates will overwrite `composer.lock` and the contents of `/vendor/`. This can be resolved at the command line by running `composer update` after a core update.

## Install Composer Locally
For details, see Composer's documentation on [Installation - Linux / Unix / OSX](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
Expand Down
78 changes: 78 additions & 0 deletions source/_docs/guides/drupal-console.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
title: Using The Drupal Console on Pantheon
description: Interacting with the Drupal Console on Pantheon.
draft: true
contributors:
- greg-1-anderson
- alexfornuto
permalink: docs/guides/:basename/
---

The [Drupal Console](https://drupalconsole.com/) is a CLI for Drupal, from which you can interact directly with your Drupal site. Pantheon has integrated the Drupal Console for all Drupal 8 sites, accessible through [Terminus](/docs/terminus).

<div class="alert alert-info">
<h4 class="info">Note</h4><p markdown="1">Drupal Console only works for Drupal 8 sites.
</p>
</div>

## Before You Begin

The methods described in this guide use Composer heavily. If you're not already using composer to manage Terminus or Drupal code, first check out:

- The [Example Drops 8 Composer](https://github.com/pantheon-systems/example-drops-8-composer) repository on GitHub
- [Using Drupal 8 and Composer](/docs/composer-drupal-8/)
- [Using GitHub Pull Requests with Composer and Drupal 8](/docs/guides/github-pull-requests/)

## Install Drupal Console

Recent versions of Drupal Console cannot be installed globally; they must be part of a Drupal site. If you are already managing your Drupal site using Composer, then it is likely that Drupal Console is already included in your project.

1. To install Drupal Console in your dev environment remotely, you can use Terminus:

terminus composer site.env -- require drupal/console

Alternately, if you work from a local repository you can install Drupal Console directly through Composer:

composer require drupal/console:~1.0 --prefer-dist --optimize-autoloader

2. Install the Drupal Console Terminus Plugin:

mkdir -p $HOME/.terminus/plugins
composer create-project --no-dev -d ~/.terminus/plugins pantheon-systems/terminus-drupal-console-plugin:~1

## Run Drupal Console Commands Remotely

The syntax for running Drupal Console commands in Terminus is:

terminus drupal <site>.<env> <command>:<subcommand>

For example, to list debug information for installed themes, run:

terminus drupal <site>.<env> theme:debug


The [Drupal Console Documentation](https://hechoendrupal.gitbooks.io/drupal-console/content/en/index.html) site lists all [available Drupal Console commands](https://hechoendrupal.gitbooks.io/drupal-console/content/en/commands/available-commands.html)


## Example Console Commands

### Inspecting / Debugging



### Create new Module


## Other considerations

- [Avoid be verbs](http://writing.rocks/to-be-or-not-to-be/)
- Avoid colloquialisms and personal opinions, feelings, or anecdotes.
- Only assume as much knowledge from the reader as specified in [Before You Begin](#before-you-begin). Otherwise explain everything.
- Notice the `draft: true` line in this template's header? If keeps this page from being visible in the live site. Be sure to remove it from your doc.

##See Also

If you can, end your doc with links to external resources that can be used to improve the reader's comprehension, or to guides on logical next steps in a common development workflow.

- [An internal guide with a relative link](/docs/get-started)
- [An external guide with a full URL](http://writing.rocks/)