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





- PHPのDependency Managementの歴史とComposer
- Composerを使ってPSR-4アプリケーションを開発する
- よく使うコマンド
- チーム開発、バージョン管理とあわせた使い方
- その他の便利な使い方

Kenichiro Kishida

October 03, 2015

More Decks by Kenichiro Kishida

Other Decks in Programming


  1. %FQFOEFODZ.BOBHFNFOU •Not Yum or Apt •inspired by node’s npm and

    ruby’s bundler •Manage libs on per-project
  2. Before Composer pear channel-discover pear.phpunit.de pear channel-discover components.ez.no pear channel-discover

    pear.symfony-project.com pear channel-discover pear.symfony.com pear install pear.symfony.com/Yaml pear update-channels pear upgrade-all pear clear-cache pear install -f -a phpunit/PHPUnit phpunit --version
  3. ߋ৽VQEBUF • όʔδϣϯΛݻఆ͢Δɺ*ͳͲΛ࢖Θͳ͍ recommend use fix version. no use *

    or dev- master • update࣌ʹύοέʔδ໊Λࢦఆ͢Δ using composer update with package and option -- with-dependencies
  4. িಥDPOqJDU 1.ϦϞʔτͷcomposer.lockΛ࠾༻ checkout remote composer.json and .lock 2.composer installͳͲΛ࠶࣮ߦ rerun

    composer install,require,update or etc.. 3.git add / git commit Photo by Seattle Municipal Archives on GATAG
  5. Repositories { "repositories": [{ "type": "vcs", "url": "git://github.com/sizuhiko/Bdd.git" },{ "type":

    "pear", "url": "https://pear2.php.net" },{ "type": "package", "package": { "name": "smarty/smarty", "version": "3.1.7", "source": { "url": "https://smarty-php.googlecode.com/svn/", "type": "svn", } }
  6. Create Project • ϑϨʔϜϫʔΫͳͲΛ࡞ͬͨͱ͖ʹ༗༻ convenience for creation framework • composer

    create-project --prefer-dist cakephp/app app • create-projectͷίʔϧόοΫΛݺͼग़͢ composer call script of create-project when defined "post-create-project-cmd": [ "php -r \"copy('config/local-example.php', 'config/local.php');\"" ]