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

packagist.jpの紹介と新機能 /#phpblt

packagist.jpの紹介と新機能 /#phpblt

2295fec4d38f59366f983d38628e6ca0?s=128

Hiraku NAKANO

July 20, 2016
Tweet

Transcript

  1. packagist.jpͷ঺հͱ ৽ػೳ PHPBLT #5

  2. ࣗݾ঺հ • @Hiraku (த໺ ୓) • PHPΧϯϑΝϨϯεؔ੢2016Ͱ
 جௐߨԋ͖ͯͨ͠ͱ͜ΖͰ͢
 http://tech.mercari.com/entry/2016/07/20/ 160602

  3. Composerͷߴ଎Խ • hirak/prestissimo ͱ͍͏ComposerϓϥάΠ ϯΛ࡞͍ͬͯ·͢ɻ࢖ͬͯΈͯͶʂ composer global require 'hirak/prestissimo' ͋ͱ͸উखʹinstall/update࣌ʹൃಈ

  4. ࠓ೔͸packagistͷ࿩Λ ͠·͢

  5. None
  6. None
  7. packagist.jp • packagist.org Λ2෼͓͖ʹϛϥʔϦϯάͯ͠ ͍·͢ • ຊՈͷ୅ΘΓʹࢦఆ͢Δͱcomposer update ͕ര଎ʹͳΔ (ίϚϯυҰߦ)


    composer conf -g repos.packagist composer https://packagist.jp
  8. 2෼͝ͱϛϥʔϦϯάΛ ࣮ݱ͢Δٕज़

  9. ී௨ʹ΍Δͱग़དྷͳ͍ • packagistͷશσʔλΛૉ௚ʹμ΢ϯϩʔυ͢ Δͱ਺࣌ؒ͸͔͔Δ • ొ࿥ύοέʔδʹൺྫ͕͔͔ͯ࣌ؒ͠Δ࢓૊ ΈͰ͸ഁ୼͢Δ • ࠩ෼ߋ৽͔͠ͳ͍

  10. packagistͷJSON͸3֊૚ • packages.json • provider-includes.json
 (ύοέʔδͷϦετ৘ใɺ8~9ݸ͙Β͍) • p/vendor/package.json
 (ύοέʔδ໊͝ͱ) •

    શ෦Ͱ6ສϑΝΠϧ͙Β͍
  11. packages.json ͷத਎ { "packages": [], "notify": "https://packagist.org/downloads/%package%", "notify-batch": "https://packagist.org/downloads/", "providers-url":

    "/p/%package%$%hash%.json", "search": "https://packagist.org/search.json?q=%query%&type=%type%", "provider-includes": { "p/provider-2013$%hash%.json": { "sha256": "4fe03986e11f75b311587794dec3504703f3d6f7c94f8fa9209f1352ecd1e64d" }, "p/provider-2014$%hash%.json": { "sha256": "b4e49c6935fb2b001aec67c541d48dea449937d19d8dda54c3bc6a53243f05cf" },
  12. provider-includes.json { "providers": { "0s1r1s/dev-shortcuts-bundle": { "sha256": "6c7710a1ca26d3c0f9dfc4c34bc3d6e71ed88d8783847ed82079601401e29b18" }, "0x20h/monoconf":

    { "sha256": "9515a0ee8fce44be80ed35292384c2f908cabbf6a710099f4743b710bc47607e" }, "11ya/excelbundle": { "sha256": "65dccb7f2d57c09c19519c1b3cdf7cbace1dfbf46f43736c2afcb95658d9c0f1" }, "1stvamp/phpweekly.info": { "sha256": "f4bbac09368b0b8c7122cae19f1ce57fa5808d691fa58b6aac9e257920dded71" }, "2085020/zendframework1": { "sha256": "360c3ede3c3572ef5f0d0209deac197e6d7f59d7899cad0ec9a45f7d5de9fa84" },
  13. Լ૚ͷϋογϡ஋ͷ఻ൖ • packages.json͕provider-includesͷϋογϡ ஋Λ఻͑Δ • provider-includes.json͕֤packageͷϋο γϡ஋Λ఻͑Δ • ϋογϡ஋͕ҧ͏=ߋ৽͕͋ͬͨ৔߹ͷΈ

  14. ࠩ෼ߋ৽ͷݪཧ • jsonϑΝΠϧͷsha256஋Λܭࢉɺผͷ஋͕͋Δ ͱ͖͚ͩμ΢ϯϩʔυ • 2෼͓͖ͩͱ10~20ϑΝΠϧ͙Β͍ͰࡁΉͷͰ ߴ଎ʹߋ৽Ͱ͖Δ • ͍͖ͳΓcronճ͢ͱࢮ͵
 ༧Ί࣌ؒΛ͔͚ͯશ෦μ΢ϯϩʔυ͓ͯ͘͠

  15. packagist๊͕͍͑ͯΔ໰୊

  16. provider-includes.jsonͷ
 ංେԽ

  17. provider-includes.json ͱ͸ • ύοέʔδ໊ͷҰཡͱɺͦͷϋογϡ஋Λه ࿥ͨ͠ϑΝΠϧ • 9ϑΝΠϧʹ෼ׂ͞ΕͯΔ(2016೥7݄20೔ݱ ࡏ) • composer

    update࣌ʹશ෦μ΢ϯϩʔυ͢Δ
  18. provider-includes.json { "providers": { "0s1r1s/dev-shortcuts-bundle": { "sha256": "6c7710a1ca26d3c0f9dfc4c34bc3d6e71ed88d8783847ed82079601401e29b18" }, "0x20h/monoconf":

    { "sha256": "9515a0ee8fce44be80ed35292384c2f908cabbf6a710099f4743b710bc47607e" }, "11ya/excelbundle": { "sha256": "65dccb7f2d57c09c19519c1b3cdf7cbace1dfbf46f43736c2afcb95658d9c0f1" }, "1stvamp/phpweekly.info": { "sha256": "f4bbac09368b0b8c7122cae19f1ce57fa5808d691fa58b6aac9e257920dded71" }, "2085020/zendframework1": { "sha256": "360c3ede3c3572ef5f0d0209deac197e6d7f59d7899cad0ec9a45f7d5de9fa84" },
  19. ͜Ε͕ͱʹ͔͘σΧ͍

  20. શ෦Ͱ10MB͙Β͍ 768636 p-provider-2013.json 1673380 p-provider-2014.json 1035890 p-provider-2015-10.json 2219849 p-provider-2015.json 1532856

    p-provider-2016-01.json 2365598 p-provider-2016-04.json 447928 p-provider-2016-07.json 173629 p-provider-archived.json 699951 p-provider-latest.json 10917717 total
  21. 10MBͬͯผʹେ͖͘ͳ͍Μ ͡Όʁͱࢥͬͨਓ͸؁͍

  22. ొ࿥ύοέʔδ਺ʹԠͯ͡૿େ ͢ΔϑΝΠϧͳͷͰ͢ • ࠓ10ສύοέʔδͰ10MB͚ͩͲɺ • 100ສύοέʔδͳΒ100MB • 1000ສύοέʔδͳΒ1GB • composer

    update͢Δ౓ʹμ΢ϯϩʔυ͢Δ
  23. ճઢ͕ࡉ͍ͱͭΒ͍΍ͭ • ҰԠɺύοέʔδͷߋ৽ස౓ͷߴ͞͝ͱʹϑΝ Πϧ͕෼ׂ͞Ε͍ͯΔ • ༧ଌΛϛεΔͱ͍ͬͺ͍ߋ৽͞ΕΔ • Ωϟογϡ͕ͳ͔ͬͨΒҙຯ͕ແ͍

  24. ͜ͷղܾͷͨΊʹ
 ࣮ݧతʹ࡞ΒΕͨػೳ͕

  25. lazy-providers

  26. ϦϙδτϦઃఆΛগ͠มߋ $ composer config -ge # ΤσΟλىಈ ~/.composer/config.json { "config":

    {}, "repositories": { "packagist": { "type": "composer", "url": "https://packagist.jp", "force-lazy-providers": true } } }
  27. lazyϞʔυ • providerΛμ΢ϯϩʔυ͠ͳ͍(10MBઅ໿) • ύοέʔδ৘ใΛϋογϡͳ͠Ͱɺ
 If-Modified-Since෇͖Ͱऔಘ • 304͕ฦΕ͹ΩϟογϡΛ࢖͏

  28. ߟ࡯ • 10MBͷઅ໿͸خ͍͠ • ϦΫΤετͷ૯਺͸૿͑Δ
 (ຊՈpackagist.orgΛ࢖͍ͬͯͨΒΉ͠Ζ஗͘ͳΓ ͦ͏) • ࿈ଓͯ͠composer update͢ΔͳΒएׯ஗͘ͳΔ

    ͔΋
  29. packagist.jpʹ
 ࣮૷ͯ͠Έ·ͨ͠
 (ࠓே͙Β͍)

  30. ਓபืूʂʂ