Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Composer Tips & Tricks

Composer Tips & Tricks

Presented at the Bulgaria PHP User Group meeting in March 2016.
https://www.facebook.com/events/1538125716485720/

Harry Dobrev

March 10, 2016
Tweet

More Decks by Harry Dobrev

Other Decks in Programming

Transcript

  1. • composer.json • composer init • composer install • composer

    update • composer require • composer.lock Composer basics
  2. composer create-project • Bootstraps your project from another package •

    Installs dependencies • Provide hooks to execute scripts
  3. • composer create-project fabpot/silex-skeleton <path> • composer create-project --repository-url=https://repo. magento.com/

    magento/project-community-edition <path> • composer create-project <your vendor>/<your template> foo composer create-project
  4. clippings/composer-init • Inspired by grunt-init • composer global require clippings/composer-init

    • composer-init use clippings/package-template • Learn more at github.com/clippings/composer-init
  5. composer update --with-dependencies composer update --with-dependencies vendor/package Updates only a

    package with its dependencies. Does not touch the rest of the packages. composer require --update-with-dependencies
  6. Travis CI Build Matrix php: - 5.3 - 5.4 -

    5.5 - 5.6 - 7 - hhvm env: - DEPS=normal - DEPS=highest - DEPS=lowest
  7. Travis CI Build Matrix install: - if [ "$DEPS" =

    "normal" ]; then composer install; fi; - if [ "$DEPS" = "highest" ]; then composer update; fi; - if [ "$DEPS" = "lowest" ]; then composer update --prefer-lowest --prefer- stable; fi;
  8. extra.branch-alias { "extra": { "branch-alias": { "dev-master": "1.0-dev" } }

    } Read more at getcomposer.org/doc/articles/aliases.md