wiki:members/GRIP-UQAM/Composer

Composer

Some Composer documentation

Other Composer documentation

Some Composer commands

  • $ ./composer.phar self-update --stable
    
  • $ ./composer.phar update
    
    $ ./composer.phar require phpbrew/phpbrew:@stable # It was hard to find a version, default version was rejected, this allows to search further.
    

Composer extensions

Includes

Example composer.json for Drupal 7

composer require drush/drush
composer require seld/jsonlint
{
    "require": {
        "drush/drush": "^8.0",
        "seld/jsonlint": "^1.4",
        "ezyang/htmlpurifier": "^4.7",
        "kraksoft/colorbox": "^1.5",
        "pelago/emogrifier": "^1.0",
        "tinymce/tinymce": "^3.5", # remove this line, this version is not available through composer!
        "ckeditor/ckeditor": "^full/4.5.1"
    }
}

Local Repositories

{
    "require": {
        "drush/drush": "8.0.5"
    },
    "repositories": [
        {
            "type": "git",
            "url": "../share/url/github.com/drush-ops/drush/8.0.5"
        },
        {
            "type": "path",
            "url": "../share/url/github.com/*/*/*"
        }
    ]
}

The next one does not work!

{
    "require": {
        "drush/drush": "8.0.5"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "file://tmp/gripuqam/share/url"
        }
    ]
}

https://getcomposer.org/doc/05-repositories.md#package-2

{
    "packages": {
        "drupal/core": {
            "8.0.5": {
{
    "name": "drupal/core",
    "version": "8.0.5",
    "dist": {
        "url": "github.com/drupal-composer/drupal-core/8.0.5",
        "type": "path"
    }
}
            }
        }
        "drush/drush": {
            "8.0.5": {
{
    "name": "drush/drush",
    "version": "8.0.5",
    "dist": {
        "url": "github.com/drush-ops/drush/8.0.5",
        "type": "path"
    }
}
            }
        }
        "psr/log": {
            "1.0.0": {
{
    "name": "psr/log",
    "version": "1.0.0",
    "dist": {
        "url": "github.com/php-fig/log/1.0.0",
        "type": "path"
    }
}
            }
        }
    }
}

{
    "require": {
        "drupal/core": "8.0.5"
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                  "name": "drupal/core",
                  "version": "8.0.5",
                  "dist": {
                      "url": "../share/url/github.com/drupal-composer/drupal-core/8.0.5",
                      "type": "path"
                  },
                  "description": "Drupal is an open source content management platform powering millions of websites and applications.",
                  "type": "drupal-core",
                  "license": "GPL-2.0+",
                  "require": {
                    "php": ">=5.5.9",
                    "symfony/class-loader": "2.7.*",
                    "symfony/console": "2.7.*",
                    "symfony/dependency-injection": "2.7.*",
                    "symfony/event-dispatcher": "2.7.*",
                    "symfony/http-foundation": "~2.7.2",
                    "symfony/http-kernel": "2.7.*",
                    "symfony/routing": "2.7.*",
                    "symfony/serializer": "2.7.*",
                    "symfony/translation": "2.7.*",
                    "symfony/validator": "2.7.*",
                    "symfony/process": "2.7.*",
                    "symfony/yaml": "2.7.*",
                    "twig/twig": "^1.23.1",
                    "doctrine/common": "2.5.*",
                    "doctrine/annotations": "1.2.*",
                    "guzzlehttp/guzzle": "~6.1",
                    "symfony-cmf/routing": "1.3.*",
                    "easyrdf/easyrdf": "0.9.*",
                    "zendframework/zend-feed": "~2.4",
                    "stack/builder": "1.0.*",
                    "egulias/email-validator": "1.2.*",
                    "masterminds/html5": "~2.1",
                    "symfony/psr-http-message-bridge": "v0.2",
                    "zendframework/zend-diactoros": "~1.1",
                    "composer/semver": "~1.0"
                  },
                  "require-dev": {
                    "behat/mink": "~1.6",
                    "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",
                    "symfony/css-selector": "2.7.*"
                  },
                  "replace": {
                    "drupal/action": "self.version",
                    "drupal/aggregator": "self.version",
                    "drupal/automated_cron": "self.version",
                    "drupal/bartik": "self.version",
                    "drupal/ban": "self.version",
                    "drupal/basic_auth": "self.version",
                    "drupal/block": "self.version",
                    "drupal/block_content": "self.version",
                    "drupal/book": "self.version",
                    "drupal/breakpoint": "self.version",
                    "drupal/ckeditor": "self.version",
                    "drupal/classy": "self.version",
                    "drupal/color": "self.version",
                    "drupal/comment": "self.version",
                    "drupal/config": "self.version",
                    "drupal/config_translation": "self.version",
                    "drupal/contact": "self.version",
                    "drupal/content_translation": "self.version",
                    "drupal/contextual": "self.version",
                    "drupal/core-annotation": "self.version",
                    "drupal/core-bridge": "self.version",
                    "drupal/core-datetime": "self.version",
                    "drupal/core-diff": "self.version",
                    "drupal/core-discovery": "self.version",
                    "drupal/core-event-dispatcher": "self.version",
                    "drupal/core-file-cache": "self.version",
                    "drupal/core-gettext": "self.version",
                    "drupal/core-graph": "self.version",
                    "drupal/core-php-storage": "self.version",
                    "drupal/core-plugin": "self.version",
                    "drupal/core-proxy-builder": "self.version",
                    "drupal/core-serialization": "self.version",
                    "drupal/core-transliteration": "self.version",
                    "drupal/core-utility": "self.version",
                    "drupal/core-uuid": "self.version",
                    "drupal/datetime": "self.version",
                    "drupal/dblog": "self.version",
                    "drupal/dynamic_page_cache": "self.version",
                    "drupal/editor": "self.version",
                    "drupal/entity_reference": "self.version",
                    "drupal/field": "self.version",
                    "drupal/field_ui": "self.version",
                    "drupal/file": "self.version",
                    "drupal/filter": "self.version",
                    "drupal/forum": "self.version",
                    "drupal/hal": "self.version",
                    "drupal/help": "self.version",
                    "drupal/history": "self.version",
                    "drupal/image": "self.version",
                    "drupal/inline_form_errors": "self.version",
                    "drupal/language": "self.version",
                    "drupal/link": "self.version",
                    "drupal/locale": "self.version",
                    "drupal/minimal": "self.version",
                    "drupal/menu_link_content": "self.version",
                    "drupal/menu_ui": "self.version",
                    "drupal/migrate": "self.version",
                    "drupal/migrate_drupal": "self.version",
                    "drupal/node": "self.version",
                    "drupal/options": "self.version",
                    "drupal/page_cache": "self.version",
                    "drupal/path": "self.version",
                    "drupal/quickedit": "self.version",
                    "drupal/rdf": "self.version",
                    "drupal/responsive_image": "self.version",
                    "drupal/rest": "self.version",
                    "drupal/search": "self.version",
                    "drupal/serialization": "self.version",
                    "drupal/seven": "self.version",
                    "drupal/shortcut": "self.version",
                    "drupal/simpletest": "self.version",
                    "drupal/standard": "self.version",
                    "drupal/stark": "self.version",
                    "drupal/statistics": "self.version",
                    "drupal/syslog": "self.version",
                    "drupal/system": "self.version",
                    "drupal/taxonomy": "self.version",
                    "drupal/telephone": "self.version",
                    "drupal/text": "self.version",
                    "drupal/toolbar": "self.version",
                    "drupal/tour": "self.version",
                    "drupal/tracker": "self.version",
                    "drupal/update": "self.version",
                    "drupal/user": "self.version",
                    "drupal/views": "self.version",
                    "drupal/views_ui": "self.version"
                  },
                  "minimum-stability": "dev",
                  "prefer-stable": true,
                  "autoload": {
                    "psr-4": {
                      "Drupal\\Core\\": "lib/Drupal/Core",
                      "Drupal\\Component\\": "lib/Drupal/Component",
                      "Drupal\\Driver\\": "../drivers/lib/Drupal/Driver"
                    },
                    "files": [
                      "lib/Drupal.php"
                    ],
                    "classmap": [
                      "lib/Drupal/Component/Utility/Timer.php",
                      "lib/Drupal/Component/Utility/Unicode.php",
                      "lib/Drupal/Core/Database/Database.php",
                      "lib/Drupal/Core/DrupalKernel.php",
                      "lib/Drupal/Core/DrupalKernelInterface.php",
                      "lib/Drupal/Core/Site/Settings.php"
                    ]
                  },
                  "config": {
                    "preferred-install": "dist",
                    "autoloader-suffix": "Drupal8"
                  },
                  "scripts": {
                    "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
                    "post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess"
                }
            }
        }
    ]
}
Last modified 3 years ago Last modified on Sep 29, 2016, 8:49:09 AM