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

LaravelをPHP8で動かしてみた

 LaravelをPHP8で動かしてみた

「Webナイト宮崎 Vol.12 ~てげPHP学びたい~」でLTした内容です
https://tegehoge.connpass.com/event/199828/

B14ef08f92c7f31e679d991dafd7d77f?s=128

Task Nagashige

January 22, 2021
Tweet

Transcript

  1. LaravelΛPHP8Ͱಈ͔ͯ͠Έͨ WebφΠτٶ࡚ Vol. 12 2021-01-22 ͨ͘͢Μ

  2. Agenda 1. ࣗݾ঺հ 2. PHP8ͷ֓ཁ঺հ 3. Laravel΁ͷಋೖ

  3. ࣗݾ঺հ ◆໊લɿͨ͘͢Μ ◆ग़਎ɿࣛࣇౡݝͷେ۱ (ٶ࡚دΓͷχϯήϯͰ͢ʂ) ◆ࣗݾ঺հ ιϑτ΢ΣΞΤϯδχΞ(εϚϗΞϓϦ։ൃ, WebγεςϜ։ൃ) ઐ໳ֶߍͷඇৗۈߨࢣ(PHPڭ͑ͯ·͢) ࣛࣇౡ.mk, ώϥϚαͳͲͷίϛϡχςΟ׆ಈ

  4. SNS΍ͬͯ·͢ʔ

  5. ྗΛೖΕ͍ͯΔίϛϡχςΟ׆ಈ ࣛࣇౡ.mk ώϥϚα ॳݟͷਓͰ΋ؾܰʹࢀՃͰ͖ΔίϛϡχςΟ ڞಉ։ൃͱ͔৭ʑ΍ͬͯΔΤϯδχΞαʔΫϧ

  6. PHP8ʹ͍ͭͯ

  7. ओཁػೳ • JITͷಋೖ • Named Arguments • Attributes • Constructor

    Property Promotion • Union Types • Match Expressions • Nullsafe Operator • ൺֱԋࢉࢠ(==)ͷڍಈݟ௚͠
  8. PHP7͔ΒPHP8΁ͷॻ͖׵͑ • ൺֱԋࢉࢠ(==)Λ࢖͍ͬͯͳ͚Ε͹ॻ͖׵͑͸͠΍ͦ͢͏ • PHP5͔ΒPHP7΁ͷॻ͖׵͑͸େมͩͬͨهԱ(ඇਪ঑ͳॻ͖ํ͕ଟ ͔͍͔ͬͨͤ΋) • Laravelͷ৔߹͸ɺ6~8ܥͷ৔߹ʹ͸PHP8ʹରԠ͍ͯ͠Δͱͷ͜ͱ • https://blog.laravel.com/laravel-php-8-support

  9. Laravel΁ͷಋೖ

  10. લఏ • ϩʔΧϧ؀ڥ(macOS)ͱQA؀ڥ(Heroku)Ͱݕূ • όʔδϣϯ؅ཧʹ͸phpbrewΛར༻ • ର৅ͷΞϓϦ͸तۀ༻ʹ࡞ͬͨ࠷௿ݶͷCRUDΞϓϦ • Laravelͷόʔδϣϯ͸7.xܥ •

    ݫ֨ϞʔυͰܕ΋ݫີʹ؅ཧ
  11. None
  12. PHP8ͷΠϯετʔϧ&༗ޮԽ $ php -v PHP 7.3.11 (cli) (built: Jun 5

    2020 23:50:40) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies $ phpbrew self-update $ phpbrew known --update $ phpbrew install 8.0.1 +default +dbs +curl $ phpbrew use php-8.0.1 $ php -v PHP 8.0.1 (cli) (built: Jan 22 2021 01:59:33) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.1, Copyright (c) Zend Technologies
  13. ϩʔΧϧαʔόͷىಈ $ php artisan serve Laravel development server started: http://127.0.0.1:8000

    PHP 8.0.1 Development Server (http://127.0.0.1:8000) started ىಈͨ͠ʂʂ
  14. Heroku΁ͷσϓϩΠ "php": "^8.0.0" "fakerphp/faker": "^1.9.1" "phpunit/phpunit": "^9.3" $ composer update

    composer.jsonͷPHPόʔδϣϯ౳Λߋ৽
  15. Heroku΁ͷσϓϩΠ -----> Building on the Heroku-20 stack -----> PHP app

    detected -----> Bootstrapping... -----> Installing platform packages... - php (8.0.1) - ext-mbstring (bundled with php) - apache (2.4.46) - nginx (1.18.0) - composer (1.10.19) (தུ) -----> Launching... Released v19 https://laravel-todo-php8.herokuapp.com/ deployed to Heroku PHP8ͰͷHeroku΁ͷσϓϩΠ੒ޭʂʂ
  16. ݁࿦ LaravelΛPHP8Ͱಈ͔͢ͷ͸ಛʹ໰୊ͳ͠

  17. ࠓޙͷ՝୊ • ։ൃɾQA؀ڥͰ͔͠ར༻Ͱ͖͍ͯͳ͍ͷͰɺϓϩμΫγϣϯ؀ڥͰ ΋࢖͑ΔΑ͏ʹݕূΛ͢Δ • PHP8ʹͳͬͯύϑΥʔϚϯε͕ͲΕ͘Β͍վળͨ͠ͷ͔ͷௐࠪ • Laravel 5.xܥͰPHP8Λ࢖͑ΔΑ͏ʹ͢ΔͨΊͷௐࠪ

  18. དྷि຤ʹ΋͘΋͘ձɺདྷ݄຤ʹ͸ϋοΧιϯ΍Γ·͢ ڵຯͷ͋Δํ͸ʮࣛࣇౡ.mkʯͰݕࡧΛʂ

  19. Thank You!!