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

SwooleをつかったフレームワークSwoftをたのしむ

 SwooleをつかったフレームワークSwoftをたのしむ

uzullaさんのPHPerKaigi2018「大統一PHP」(https://speakerdeck.com/uzulla/da-tong-php)で紹介されていたSwooleという非同期かつ、Coroutineの仕組みをもったライブラリがあります
Swooleを用いたフレームワークの1つにSwoftがあります。
SwoftはビルトインでHTTPのサーバとして動作し、PSR-7、PSR-14、PSR-15、PSR-16を準拠している
モダンでハイパフォーマンスなAOPとCoroutineをもったPHPフレームワークです
そんないけてるフレームワークSwoftを紹介します

#phpconsen

CyberAgent SGE Engineer

January 26, 2019
Tweet

More Decks by CyberAgent SGE Engineer

Other Decks in Technology

Transcript

  1. • גࣜձࣾαΠόʔΤʔδΣϯτ • 4(&౷ׅຊ෦ٕज़౷ׅࣨࣨ௕ • ࢠձࣾࣾ$50 • גࣜձࣾ$SBGU&HH • גࣜձࣾδʔΫϨετ

    • גࣜձࣾαϜβοϓ • നҪɹӳ • ΤϯδχΞ • #MPH IUUQBNFCMPKQHPPEPP ͓લɺ୭Α • ઋ୆ࢢຽ • 5XJUUFS !HPPEPP • %2 ͙ͪ͢Ή '# 
 ϓΫϦϙ ཱྀܳਓ
  2. •Base on Swoole extension •Built-in HTTP, TCP, WebSocket Coroutine Server

    •Powerful AOP (Aspect Oriented Programming) •Flexible and comprehensive annotations framework •Global dependency injection container •PSR-7 based HTTP message implementation •PSR-14 based event manager •PSR-15 based middleware •PSR-16 based cache design •Scalable high performance RPC •Holistic service governance, fallback, load balance, service registration and discovery •Database ORM •Universal connection pools •Mysql, Redis, RPC, HTTP Coroutine Clients •Coroutine driver client and blocking driver client seamlessly switch automatically •Coroutine and asynchronous task delivery •Custom user processes •RESTful supported •Internationalization (i18n) supported •High performance router •Fast and flexible parameter validator •Alias mechanism •Powerful log component •Cross-platform application auto- reload mechanism https://github.com/swoft-cloud/swoft ͷREADMEͷӳ༁ Ҿ༻ɿ
  3. •Built-in HTTP, TCP, WebSocket Coroutine Server •Powerful AOP (Aspect Oriented

    Programming) •Flexible and comprehensive annotations framework •Global dependency injection container •PSR-7 based HTTP message implementation •Database ORM •Universal connection pools
  4. 4XPGUͷϑΥϧμߏ੒ ࠷খݶ Project ├ app         │ ├ Controllers │ │ └ BooksController.php │ └

    Models │   └ Entity │    └ Books.php ├ config │ ├ beans │ │ └ base.php │ └ properties │   ├ app.php │   └ db.php ├ public ├ runtime │ ├ logs │ ├ uploadfiles │ └ sessions ├ resources │ └ views │   └ books │     └ view.php └ bin   ├ bootstrap.php   └ swoft
  5. 4XPGUͷϑΥϧμߏ੒ ࠷খݶ Project ├ app         │ ├ Controllers │ │ └ BooksController.php │ └

    Models │   └ Entity │    └ Books.php ├ config │ ├ beans │ │ └ base.php │ └ properties │   ├ app.php │   └ db.php ├ public ├ runtime │ ├ logs │ ├ uploadfiles │ └ sessions ├ resources │ └ views │   └ books │     └ view.php └ bin   ├ bootstrap.php   └ swoft ίϯτϩʔϥʔ Ϟσϧ
  6. 4XPGUͷϑΥϧμߏ੒ ࠷খݶ Project ├ app         │ ├ Controllers │ │ └ BooksController.php │ └

    Models │   └ Entity │    └ Books.php ├ config │ ├ beans │ │ └ base.php │ └ properties │   ├ app.php │   └ db.php ├ public ├ runtime │ ├ logs │ ├ uploadfiles │ └ sessions ├ resources │ └ views │   └ books │     └ view.php └ bin   ├ bootstrap.php   └ swoft ౎౓ಡΈࠐ·ΕΔ ઃఆϑΝΠϧ ˞FOW͕༏ઌ CFBOੜ੒࣌ʹಡΈࠐ·ΕΔ ϑΝΠϧ
  7. 4XPGUͷϑΥϧμߏ੒ ࠷খݶ Project ├ app         │ ├ Controllers │ │ └ BooksController.php │ └

    Models │   └ Entity │    └ Books.php ├ config │ ├ beans │ │ └ base.php │ └ properties │   ├ app.php │   └ db.php ├ public ├ runtime │ ├ logs │ ├ uploadfiles │ └ sessions ├ resources │ └ views │   └ books │     └ view.php └ bin   ├ bootstrap.php   └ swoft ੩తϑΝΠϧஔ͖৔ DTTɺKT
  8. 4XPGUͷϑΥϧμߏ੒ ࠷খݶ Project ├ app         │ ├ Controllers │ │ └ BooksController.php │ └

    Models │   └ Entity │    └ Books.php ├ config │ ├ beans │ │ └ base.php │ └ properties │   ├ app.php │   └ db.php ├ public ├ runtime │ ├ logs │ ├ uploadfiles │ └ sessions ├ resources │ └ views │   └ books │     └ view.php └ bin   ├ bootstrap.php   └ swoft Ұ࣌ϑΝΠϧஔ͖৔
  9. 4XPGUͷϑΥϧμߏ੒ ࠷খݶ Project ├ app         │ ├ Controllers │ │ └ BooksController.php │ └

    Models │   └ Entity │    └ Books.php ├ config │ ├ beans │ │ └ base.php │ └ properties │   ├ app.php │   └ db.php ├ public ├ runtime │ ├ logs │ ├ uploadfiles │ └ sessions ├ resources │ └ views │   └ books │     └ view.php └ bin   ├ bootstrap.php   └ swoft UFNQMBUFϑΝΠϧ
  10. 4XPGUͷϑΥϧμߏ੒ ࠷খݶ Project ├ app         │ ├ Controllers │ │ └ BooksController.php │ └

    Models │   └ Entity │    └ Books.php ├ config │ ├ beans │ │ └ base.php │ └ properties │   ├ app.php │   └ db.php ├ public ├ runtime │ ├ logs │ ├ uploadfiles │ └ sessions ├ resources │ └ views │   └ books │     └ view.php └ bin   ├ bootstrap.php   └ swoft ىಈ༻ϑΝΠϧ
  11. %FGBVMU 4MJN &BTZ4XPPMF W 4XPGU ճ໨    ̎ճ໨

       ճ໨    ճ໨    ̑ճ໨    ฏۉ    ˞ϩδοΫมߋͳ͠ͷঢ়ଶ 1)1 4XPPMF
  12. %FGBVMU 4MJN &BTZ4XPPMF W 4XPGU ճ໨    ̎ճ໨

       ճ໨    ճ໨    ̑ճ໨    ฏۉ    ˞ϩδοΫมߋͳ͠ͷঢ়ଶ 1)1 4XPPMF ϑϨʔϜϫʔΫͷ ҧ͍͸ޡࠩͰ͢ʂ https://github.com/shirai-suguru/isucon8-swoft https://github.com/shirai-suguru/isucon8-easyswoole &BTZ4XPPMFͷ࣮૷ɿ 4XPGUͷ࣮૷ɿ