Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PHPフレームワークLaravel 5でのサービスリニューアル実例

3,070 views

Published on

イベント情報検索サービスdots.ではLaravel 5でサービスリニューアルを行っています。

Published in: Technology
  • DOWNLOAD THI5 BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

PHPフレームワークLaravel 5でのサービスリニューアル実例

  1. 1. PHPフレームワークLaravel 5での サービスリニューアル実例 2015/07/14 @ヒカ☆ラボ
  2. 2. 自己紹介 杉山 隆(Takashi Sugiyama) @best_not_best Python, PHP 2008/04〜2013/03 : ヤフー株式会社 2013/04〜2015/03 : 株式会社アイ・エム・ジェイ 2015/04〜 : 株式会社インテリジェンス dots. 開発リーダー
  3. 3. dots. http://eventdots.jp/ エンジニアのためのイベント情報検索サービス 2013年10月リリース ユーザー数20,000人突破!!
  4. 4. dots. 各種イベントサービスAPI(一部はページを直接スク レイピング)からイベント情報を取得。(全イベン トの約9割) 取得したイベントは本文を形態素解析して、自動で タグ付け dots.主催のイベントも1割ほどある
  5. 5. dots. CakePHP + Nginx + Apache + mod_php + MariaDB … 等
  6. 6. dots. コードが汚い!!
  7. 7. dots. もともと外注 消えることの無い「TODO」コメント 大量のコメントアウト Viewの大半を占める「<?...?>」 Unitテスト?何それ? 運用しづらい・・・
  8. 8. dots. よろしい ならばリニューアルだ
  9. 9. リニューアルにおける前提 「エンジニア」のためのサービスなのだから、エン ジニアから見てイケてる技術を使おう! 新しい技術に挑戦したい! 決して「CakePHPがイケてない」というわけではな いです(とても重要)
  10. 10. FW選定にあたって 。
  11. 11. Laravel ウェブ職人のためのPHPフレームワーク Best PHP Frameworks for 2014 cf. http://www.sitepoint.com/best-php-frameworks-2014/ 名前は「ナルニア国物語」から cf. http://www.slideshare.net/KenichiMukai/php-study74
  12. 12. 今回話すこと dots.のサーバ構成、アプリケーション構成 導入したモジュール … 等
  13. 13. 今回話さないこと Laravelの基本機能やartisanコマンドについて → 直接お声掛けください。
  14. 14. サーバ構成
  15. 15. ファイル構成 Web、Admin、Batchで同じrepositoryを使用 Controller
  16. 16. ルーティング route.php でドメインによってルーティング指定 // Set environment switch (getenv('APP_ENV')) { case 'production': $env = ''; break; case 'staging': $env = 'stg.''; ... } Route::group([ 'namespace' => 'Web', 'domain' => $env . 'eventdots.jp', ], function () { Route::get('/', ['as' => 'web.event.index', 'uses' => 'EventController@index]); (中略) } );
  17. 17. ファイル構成 View
  18. 18. レンダリング コントローラから $this->render('index’); または View::make('web.index'); で呼び出す。
  19. 19. Laravel for Web Application
  20. 20. ルーティング switch (getenv('APP_ENV')) { case 'production': $env = ''; $https = 'https'; break; ... } Route::group([ 'namespace' => 'Web', 'domain' => $env . 'eventdots.jp', ‘middleware’ => [‘csrf’, 'cors']], function () use ($https) { Route::get('/', ['as' => 'web.event.index’, 'uses' => 'EventController@index', 'http']); } );
  21. 21. ルーティング switch (getenv('APP_ENV')) { case 'production': $env = ''; $https = 'https'; break; ... } Route::group([ 'namespace' => 'Web', 'domain' => $env . 'eventdots.jp', ‘middleware’ => [‘csrf’, 'cors']], function () use ($https) { Route::get('/', ['as' => 'web.event.index’, 'uses' => 'EventController@index', 'http']); } );
  22. 22. ルーティング プロコトルを指定 指定外のプロトコルでアクセスしようとすると、指 定されたプロトコルのURLにリダイレクトされる。 本番環境以外は、オレオレ証明書を使っていること もあるため、環境によってプロトコル指定。(オレ オレの環境でhttps指定すると404になる・・・。)
  23. 23. ルーティング switch (getenv('APP_ENV')) { case 'production': $env = ''; $https = 'https'; break; ... } Route::group([ 'namespace' => 'Web', 'domain' => $env . 'eventdots.jp', ‘middleware’ => [‘csrf’, 'cors']], function () use ($https) { Route::get('/', ['as' => 'web.event.index’, 'uses' => 'EventController@index', 'http']); } );
  24. 24. ルーティング ミドルウェア 全てのルートでCSRF対策 (IlluminateFoundationHttpMiddlewareVerif yCsrfToken)とCORS設定を追加 CSRF IlluminateFoundationHttpMiddlewareVerify CsrfToken を使用 CORS cf. https://github.com/barryvdh/laravel-cors
  25. 25. ルーティング ミドルウェア名は app/Http/Kernel.php で設定 protected $routeMiddleware = [ 'csrf' => 'IlluminateFoundationHttpMiddlewareVerifyCsrfToken', 'web.auth' => 'DotsHttpMiddlewareWebAuthenticate', 'web.guest' => 'DotsHttpMiddlewareRedirectIfWebAuthenticated', ... ];
  26. 26. ソーシャルログイン Laravel Socialite cf. https://github.com/laravel/socialite 以下のようにして実装。 Socialite::with($socialType)->redirect();
  27. 27. ログ monolog + FluentHandler cf. https://github.com/dakatsuka/MonologFluentHandler fluentdを使ってIDCFのオブジェクトストレージへ。 (本番環境のみ)
  28. 28. 画像ファイル 管理ツールからアップロードされた画像ファイルもIDCFのオブジェクトストレージへ cf. https://github.com/aws/aws-sdk-php-laravel config/filesystems.php で以下のように設定 'disks' => [ 'private' => [ 'local' => [ 'driver' => 'local', 'root' => env('PRIVATE_LOCAL_ROOT', storage_path() . '/app'), ], 's3' => [ 'driver' => 's3', 'key' => env('STORAGE_KEY'), 'secret' => env('STORAGE_SECRET'), 'base_url' => env('STORAGE_BASE_URL'), 'bucket' => env('PRIVATE_BUCKET'), ], ], 'public' => [ .... ], ],
  29. 29. Laravel for Batch
  30. 30. Laravel for Batch 特別なことは特にしていない Artisan schedulerでcron設定 Queueで非同期処理 外部イベント取得処理、メール配信処理を実行 Laravelに機能が充実している
  31. 31. その他 Webサービス構築に必要な機能は大抵そろっている (Redis、Cache、Cashier等) かゆい所に手がとどく関数がたくさんある (camel_case(), srt_limit()) メンテナンスモードへの切り替え機能もある
  32. 32. 要検証 メモリの問題 cf. http://blog.a-way-out.net/blog/2015/03/26/php-framework-benchmark/
  33. 33. dots. 2015年8月リニューアル予定 絶賛テスト中!
  34. 34. 今後やること イベントのタグ付け(分類、形態素解析)の精度向 上 そもそもバッチはPHPで良いのか・・・? アクセスログやGoogle Analyticsのデータを使った データ解析基盤の構築
  35. 35. and more...
  36. 36. イベント・コワーキングスペース dots. 2015年8月オープン予定 渋谷駅 ハチ公口から徒歩3分 最大収容人数 約200名(着席) http://eventdots.jp/space
  37. 37. イベント・コワーキングスペース dots. ※画像はイメージです。
  38. 38. ご清聴ありがとうございました。

×