Problem/Motivation

Composer Behaviors We Want To Support

Install Drupal 8 using Composer:

$ composer create-project drupal/drupal path/to/drupal 8.0.*
$ cd path/to/drupal
$ ./vendor/bin/phpunit -c core/

Travis test here: https://travis-ci.org/paul-m/d8-create-project (updated version: https://travis-ci.org/timmillwood/d8-create-project)

Adding a dependency to Drupal 8 using Composer:

$ cd drupalroot/
$ composer require crell/api-problem
$ ./vendor/bin/phpunit -c core/

Travis test here: https://travis-ci.org/paul-m/d8-drupal-require

Proposed resolution

Remaining tasks

User interface changes

API changes

There are many things Drupal could improve when it comes to its Composer use.

Install Drupal core using Composer

This would allow modules to depend on specific versions of Drupal core, and allow you to download Drupal with Composer.

Install Drupal contributed projects using Composer

This allows installing Drupal modules and themes with Composer. Modules could also depend on specific versions of the projects as well.

Composer usage in Drupal core

This fixes some of the use of Composer in Drupal core, for additional awesomeness.

Use Composer to manage contrib dependencies

These issues deal with contrib modules using Composer to manage their dependencies.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because it is improving the use of something to Drupal.
Issue priority Normal
Prioritized changes This is a prioritized change because it improves developer experience, allowing Drupal to be used in a way that is more familiar to the greater PHP community.
Disruption Varying levels of disruption. Individual issues within the meta will have to evaluate disruption separately.

Comments

RobLoach’s picture

Issue summary: View changes

a

RobLoach’s picture

Issue summary: View changes

Updated issue summary.

RobLoach’s picture

Issue summary: View changes

Updated issue summary.

RobLoach’s picture

Issue tags: +composer

Tagging

RobLoach’s picture

Issue summary: View changes

Updated issue summary.

patcon’s picture

Nice. Is there an issue that properly captures the thought below, without polluting another thread?

Relevant excerpt:
#1612910-34: [PP-1, policy, no patch] Switch to Semantic Versioning for Drupal contrib extensions (modules, themes, etc)

EDIT: It's a whole other line of discussion whether the huge drupal core (essentially many interoperable modules with their own API's) can actually share a single semver schema. Maybe that's the root of the bigger question that we can't quite wrap our minds around (myself included), because we recognize it's such a drastic step. Taken to its logical extension (and this is definitely a thought-in-progress), Drupal core is really just a meta-package with a bunch of component libraries, each with their own independantly evolving API. Maybe a contrib module doesn't really want to set a dependency on a version of the monolithic drupal core meta-package, but instead on a specific version of watchdog or views or admin_overlay or user. That might be the only discussion that's possible to have in a meaningful way...

Related: #586146-16: [policy, no patch] Decide if and how to implement semantic versioning for Drupal 8.x

EDIT: Meh. Opened a new issue :)
#2018019: Split core modules into separate repos with independently versioned API's

patcon’s picture

Issue summary: View changes

Updated issue summary.

RobLoach’s picture

Issue summary: View changes

Updated issue summary.

Mile23’s picture

Issue summary: View changes
Mile23’s picture

Issue summary: View changes

Added a link to a test I made to validate Drupal 8's use of Composer. https://github.com/paul-m/d8-create-project

Mile23’s picture

Issue summary: View changes

And another one for composer require: https://github.com/paul-m/d8-require-drupal

Mile23’s picture

Mile23’s picture

Mile23’s picture

Issue summary: View changes
Les Lim’s picture

Issue summary: View changes

Added beta evaluation.

Les Lim’s picture

Issue summary: View changes
Mile23’s picture

Issue summary: View changes

Added some behaviors we want to support.

Please discuss these. :-)

MKorostoff’s picture

Added some behaviors we want to support.

Please discuss these. :-)

For me the big one is composer require. Composer is a dependency manager—if I can't use it to add dependencies it's not really much use to me. I would love to see that feature make it in.

Mile23’s picture

timmillwood’s picture

Looks like this might just be working:

$ composer create-project drupal/drupal drupal 8.0.*@dev --no-progress
Installing drupal/drupal (8.0.x-dev a9f2eead745dc3df58313c360eca58712318fb06)
  - Installing drupal/drupal (8.0.x-dev a9f2eea)
    Cloning a9f2eead745dc3df58313c360eca58712318fb06

Created project in drupal
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing composer/installers (v1.0.21)
    Downloading

  - Installing masterminds/html5 (2.1.1)
    Downloading

  - Installing react/promise (v2.2.0)
    Downloading

  - Installing guzzlehttp/streams (3.0.0)
    Downloading

  - Installing guzzlehttp/ringphp (1.1.0)
    Downloading

  - Installing guzzlehttp/guzzle (5.3.0)
    Downloading

  - Installing symfony/dom-crawler (v2.7.0)
    Loading from cache

  - Installing symfony/css-selector (v2.6.9)
    Loading from cache

  - Installing symfony/browser-kit (v2.7.0)
    Loading from cache

  - Installing fabpot/goutte (v2.0.4)
    Downloading

  - Installing symfony/process (v2.6.9)
    Loading from cache

  - Installing symfony/event-dispatcher (v2.6.9)
    Loading from cache

  - Installing behat/mink (v1.6.1)
    Downloading

  - Installing behat/mink-browserkit-driver (v1.2.0)
    Downloading

  - Installing behat/mink-goutte-driver (v1.1.0)
    Downloading

  - Installing doctrine/lexer (v1.0.1)
    Downloading

  - Installing egulias/email-validator (1.2.8)
    Downloading

  - Installing psr/log (1.0.0)
    Downloading

  - Installing symfony/debug (v2.7.0)
    Loading from cache

  - Installing symfony/http-foundation (v2.6.9)
    Loading from cache

  - Installing symfony/http-kernel (v2.6.9)
    Loading from cache

  - Installing stack/builder (v1.0.3)
    Downloading

  - Installing mikey179/vfsstream (v1.5.0)
    Downloading

  - Installing zendframework/zend-stdlib (2.4.2)
    Downloading

  - Installing zendframework/zend-escaper (2.4.2)
    Downloading

  - Installing zendframework/zend-feed (2.4.2)
    Downloading

  - Installing phpunit/php-file-iterator (1.4.0)
    Loading from cache

  - Installing doctrine/instantiator (1.0.4)
    Downloading

  - Installing sebastian/recursion-context (1.0.0)
    Downloading

  - Installing sebastian/exporter (1.2.0)
    Downloading

  - Installing sebastian/diff (1.3.0)
    Downloading

  - Installing sebastian/comparator (1.1.1)
    Downloading

  - Installing phpdocumentor/reflection-docblock (2.0.4)
    Loading from cache

  - Installing phpspec/prophecy (v1.4.1)
    Loading from cache

  - Installing sebastian/version (1.0.5)
    Downloading

  - Installing sebastian/environment (1.2.2)
    Downloading

  - Installing phpunit/php-text-template (1.2.0)
    Downloading

  - Installing phpunit/php-token-stream (1.4.1)
    Downloading

  - Installing phpunit/php-code-coverage (2.1.3)
    Downloading

  - Installing sebastian/global-state (1.0.0)
    Downloading

  - Installing symfony/yaml (v2.6.9)
    Loading from cache

  - Installing phpunit/phpunit-mock-objects (2.3.3)
    Loading from cache

  - Installing phpunit/php-timer (1.0.5)
    Downloading

  - Installing phpunit/phpunit (4.6.10)
    Downloading

  - Installing easyrdf/easyrdf (0.9.1)
    Downloading

  - Installing symfony/routing (v2.6.9)
    Loading from cache

  - Installing symfony-cmf/routing (1.3.0)
    Downloading

  - Installing doctrine/annotations (v1.2.4)
    Downloading

  - Installing doctrine/collections (v1.3.0)
    Downloading

  - Installing doctrine/cache (v1.4.1)
    Downloading

  - Installing doctrine/inflector (v1.0.1)
    Downloading

  - Installing doctrine/common (v2.4.2)
    Downloading

  - Installing twig/twig (v1.18.1)
    Downloading

  - Installing symfony/translation (v2.7.0)
    Loading from cache

  - Installing symfony/validator (v2.6.9)
    Loading from cache

  - Installing symfony/serializer (v2.6.9)
    Loading from cache

  - Installing symfony/dependency-injection (v2.6.9)
    Loading from cache

  - Installing symfony/class-loader (v2.6.9)
    Loading from cache

  - Installing sdboyer/gliph (0.1.8)
    Downloading

  - Installing drupal/core (8.0.0-beta11)
    Loading from cache

behat/mink suggests installing behat/mink-selenium2-driver (slow, but JS-enabled driver for any app (requires Selenium2))
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
symfony/http-kernel suggests installing symfony/config ()
symfony/http-kernel suggests installing symfony/console ()
symfony/http-kernel suggests installing symfony/finder ()
symfony/http-kernel suggests installing symfony/var-dumper ()
zendframework/zend-stdlib suggests installing zendframework/zend-eventmanager (To support aggregate hydrator usage)
zendframework/zend-stdlib suggests installing zendframework/zend-serializer (Zend\Serializer component)
zendframework/zend-stdlib suggests installing zendframework/zend-servicemanager (To support hydrator plugin manager usage)
zendframework/zend-stdlib suggests installing zendframework/zend-filter (To support naming strategy hydrator usage)
zendframework/zend-feed suggests installing zendframework/zend-cache (Zend\Cache component)
zendframework/zend-feed suggests installing zendframework/zend-db (Zend\Db component)
zendframework/zend-feed suggests installing zendframework/zend-http (Zend\Http for PubSubHubbub, and optionally for use with Zend\Feed\Reader)
zendframework/zend-feed suggests installing zendframework/zend-servicemanager (Zend\ServiceManager component, for default/recommended ExtensionManager implementations)
zendframework/zend-feed suggests installing zendframework/zend-validator (Zend\Validator component)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
easyrdf/easyrdf suggests installing ml/json-ld (~1.0)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/translation suggests installing symfony/config ()
symfony/validator suggests installing symfony/intl ()
symfony/validator suggests installing symfony/config ()
symfony/validator suggests installing symfony/property-access (For using the 2.4 Validator API)
symfony/validator suggests installing symfony/expression-language (For using the 2.4 Expression validator)
symfony/dependency-injection suggests installing symfony/config ()
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
Writing lock file
Generating autoload files
Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? n
timmillwood’s picture

I have run this through travis again and it gets the code ok, but results in two vendor directories '/vendor' and '/core/vendor' which is causing issues.

https://travis-ci.org/timmillwood/d8-create-project

timmillwood’s picture

Issue summary: View changes

I have opened a new issue to sort out the duplicate vendor directory problem.

#2500295: 'composer install' creates two vendor directories

Mile23’s picture

timmillwood’s picture

webflo’s picture

Mile23’s picture

Ladies and gentlemen, after #2380389: Use a single vendor directory in the root, we have: https://travis-ci.org/paul-m/d8-drupal-require

(Spoiler: It's passing.)

We can now say composer require crell/api-problem and it works.

https://travis-ci.org/paul-m/d8-create-project still fails, but actually looks solvable.

webflo’s picture

https://travis-ci.org/paul-m/d8-create-project fails because the package on packagist is outdated. Just wait a few days and it will work.

Mile23’s picture

Here's a test that proves that you can (minimally) use core as a dependency of your own project: https://travis-ci.org/paul-m/d8-require-drupal

Mile23’s picture

jhedstrom’s picture

Category: Task » Plan
jhedstrom’s picture

Has anybody looked at how much work it would be for Drupal to discover modules and themes in the vendor directory (if it's possible at all)?

That would certainly reduce the amount of odd things we have to do to support proper composer use.

webflo’s picture

Discovery is one problem, but we ship web accessible assets with our modules/themes and deny access to the vendor folder completely.

lpalgarvio’s picture

Careful that in 8.1-beta2, with zendframework/zend-stdlib 2.7.3, zend-hydrator was still being used, but as of zend-stdlib 3.0.0, it has been deprecated and removed as dependency from zend-stdlib (no longer installed by default).

from stdlib 2.7.3:

    "require": {
        "php": ">=5.5",
        "zendframework/zend-hydrator": "~1.0"
    },

That means if some code is using classes from the hydrator, the dependency will need to be added manually to the require in composer or the classes will need to be reworked.

https://api.drupal.org/api/drupal/vendor!zendframework!zend-hydrator!src...

The result -- if you download the 8.1-beta2 tarball, zend-hydrator is included; if you use composer to get drupal8, it will not be included.

more info:
https://github.com/drupal-composer/drupal-project
https://bojanz.wordpress.com/2015/09/18/d8-composer-definitive-intro/

## 3.0.0 - 2016-02-03

### Added

- [#51](https://github.com/zendframework/zend-stdlib/pull/51) adds PHP 7 as a
  supported PHP version.
- [#51](https://github.com/zendframework/zend-stdlib/pull/51) adds a migration
  document from v2 to v3. Hint: if you use hydrators, you need to be using
  zend-hydrator instead!
- [#51](https://github.com/zendframework/zend-stdlib/pull/51) adds automated
  documentation builds to gh-pages.

### Deprecated

- Nothing.

### Removed

- [#33](https://github.com/zendframework/zend-stdlib/pull/33) - removed
  deprecated classes
  - *All Hydrator classes* see #22.
  - `Zend\Stdlib\CallbackHandler` see #35
- #37: Missing Children when looking at recent comments(https://github.com/zendframework/zend-stdlib/pull/37) - removed
  deprecated classes and polyfills:
  - `Zend\Stdlib\DateTime`; this had been deprecated since 2.5, and only
    existed as a polyfill for the `createFromISO8601()` support, now standard
    in all PHP versions we support.
  - `Zend\Stdlib\Exception\InvalidCallbackException`, which was unused since #33.
  - `Zend\Stdlib\Guard\GuardUtils`, which duplicated `Zend\Stdlib\Guard\AllGuardsTrait`
    to allow usage with pre-PHP 5.4 versions.
  - `src/compatibility/autoload.php`, which has been dprecated since 2.5.
- #37: Missing Children when looking at recent comments(https://github.com/zendframework/zend-stdlib/pull/37) - removed
  unneeded dependencies:
  - zend-config (used only in testing ArrayUtils, and the test was redundant)
  - zend-serializer (no longer used)
- [#51](https://github.com/zendframework/zend-stdlib/pull/51) removes the
  documentation for hydrators, as those are part of the zend-hydrator
  component.

### Fixed

- Nothing.
RobLoach’s picture

Version: 8.0.x-dev » 8.1.x-dev
RobLoach’s picture

Issue summary: View changes
hswong3i’s picture

Issue summary: View changes

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.