Laravel5.5 - Package Auto Discoveryを理解する

32110e49878cbda9c310dcc5c53e750c?s=47 k-kurikuri
September 13, 2017

Laravel5.5 - Package Auto Discoveryを理解する

LaraLa vol.1 LT資料

32110e49878cbda9c310dcc5c53e750c?s=128

k-kurikuri

September 13, 2017
Tweet

Transcript

  1. Laravel5.5 Package Auto DiscoveryΛཧղ͢Δ k-kurikuri@LaraLab vol.1

  2. ΞδΣϯμ • Package Auto Discoveryͷ֓ཁ • ۩ମྫΛ࢖ͬͯϝϦοτͷઆ໌ • Package Auto

    Discoveryͷ࢓૊Έ • ·ͱΊ
  3. ࣗݾ঺հ • 2೥൒͘Β͍LaravelϚϯ • ιʔγϟϧήʔϜ։ൃͯ͠ΔΤϯδχΞ • Twitter, Github΋@k-kurikuriͰ΍ͬͯ·͢

  4. ॕ Laravel5.5 LTS ϦϦʔε!

  5. Laravel5.5Ͱಋೖ͞Εͨ Package Auto Discoveryͷ ࢓૊Έʹ͍ͭͯղઆ

  6. Package Auto Discoveryͱ͸? • ௚༁͸ύοέʔδ(composer)ͷࣗಈݕग़ • Laravel༻ʹ࡞੒͞Εͨύοέʔδ಺ͷServiceProvider, FacadeΛcomposer installޙɺࣗಈͰϩʔυͯ͘͠ΕΔ •

    composer remove࣌͸ࣗಈϩʔυ͠ͳ͘ͳΔ • Package Auto DiscoveryΛΞϓϦଆͰແޮʹ͢Δ͜ͱ ΋Մೳ
  7. laravel-debugbar ϓϩϑΝΠϥʔΛྫʹઆ໌

  8. ͜Μ

  9. laravel-debugbarͷinstallखॱ • composer require -dev laravel-debugbar • app.phpͷprovider, aliasesΩʔʹ֘౰͢Δ ServiceProvider,

    FacadeΛιʔεʹ௥Ճ͢Δ php artisan vendor:publish΋खॱͱͯ͋͠Γ·͕͢ɺ Auto Package Discoveryͱ͸ؔ܎ͳ͍ͨΊׂѪ
  10. laravel-debugbarͷinstallखॱ • composer require -dev laravel-debugbar • app.phpͷprovider, aliasesΩʔʹ֘౰͢Δ ServiceProvider,

    FacadeΛιʔεʹ௥Ճ͢Δ
  11. Auto Package Discoveryͷ ࢓૊Έ • composer.jsonͷ{“extra” : ”laravel"}͔Β ServiceProvider, FacadeΛࣗಈϩʔυ

    • composer installޙʹ࡞੒͞ΕΔɺvendor/ composer/installed.json͔Β࣮ࡍ͸ϩʔυ͢Δ • Laravelىಈ࣌ʹطଘͷServiceProvider, Facadeͷ ഑ྻϦετʹϚʔδ͞ΕॳظԽ͞ΕΔ
  12. "extra": { "laravel": { "providers": [ "Barryvdh\\Debugbar\\ServiceProvider" ], "aliases": {

    "Debugbar": "Barryvdh\\Debugbar\\Facade" } } } laravel-debugbarͷ composer.jsonΛҰ෦ൈਮ
  13. "extra": {
 "laravel": {
 "dont-discover": [
 ]
 } } ΞϓϦέʔγϣϯͷcomposer.jsonൈ

  14. ·ͱΊ • composerϥΠϒϥϦΛ࢖͏ࡍ͸ɺ࢓૊ΈΛಛʹؾʹ͠ͳ ͍Ͱ࢖͑Δ • composer.jsonͷ{“extra” : “laravel”}ʹରԠͯ͠ͳ͍ϥΠϒ ϥϦʹ͸దԠ͞Εͳ͍ •

    ࣗ࡞ͰcomposerΛެ։͢Δ࣌ʹ͸{“extra” : “laravel”}Λઃ ఆ͢ΔͱϢʔβʔϑϨϯυϦʔʹ • ·͊ɺͱʹ͔͘ศརʹͳͬͨʂ(ڧҾ)
  15. ͝੩ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠