Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Laravel5.1をつかった Webアプリケーション開発
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
kan
February 17, 2016
Programming
190
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Laravel5.1をつかった Webアプリケーション開発
いまどきのPHPフレームワークは、こんなことになってるよ
kan
February 17, 2016
More Decks by kan
See All by kan
Androidアプリ開発にクリーンアーキテクチャを取り入れよう(OSS編)
notice
0
180
Androidアプリ開発にクリーンアーキテクチャを取り入れよう
notice
0
680
Other Decks in Programming
See All in Programming
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
AIに “答え“を書かせるのを やめてみた
___akari11
0
130
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
1
180
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
110
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.3k
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
180
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
34k
[JA] Domain Modeling with Vanilla Rails: 「操作」から再考するRailsの設計論
yasaichi
4
740
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
160
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
190
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
200
APNsからLive Activityを開始する話
yumnumm
0
170
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
67k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Leo the Paperboy
mayatellez
10
2.4k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Ethics towards AI in product and experience design
skipperchong
2
440
My Coaching Mixtape
mlcsv
0
360
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Become a Pro
speakerdeck
PRO
31
6.3k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
Building the Perfect Custom Keyboard
takai
2
910
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
320
Transcript
いまどきのPHPフレームワークは、 こんなことになってるよ Laravel5.1をつかった Webアプリケーション開発 2015/08/20
[email protected]
http://www.notice.co.jp/ @notice_inc
お話しすること • フレームワーク・アーキテクチャ • Laravelの特徴 • Laravelのアプリケーション開発サイクル • ステージング環境構築 •
脆弱性検査とパフォーマンス検査 • CI
フレームワーク・アーキテクチャ • PofEAA (Patterns of Enterprise Application Architecture) • DDD(Domain
Driven Development) • GoF Design Patterns • (The Three Amigos, UML)
最近、話題のアーキテクチャ MicroService Architecture PofEAAの著者マーティン・ファウラー氏が提唱 こんな話も… http://www.slideshare.net/AkiraMiki/20160722-microservice PHP Micro frameworks こっちは小さい・シンプルって方
Lumen,Slim,Silex
Laravel5.1の特徴 • PHP >= 5.5.9 • LTS(Long Term Support) •
Composerによるパッケージ管理 • Symfony2コンポーネント継承 • IoCコンテナ装備 • データベースマイグレーション機能 • 強力なORM(Eloquent ORM) • Bladeテンプレートエンジン • gulpが標準タスクランナー(Elixir)
ベンチマーク 遅い、大食い… DIのせいかな?? 全てのサービスがリクエストごとにDI対象 しかし、 不必要なサービスを外すとか チューニングすれば、解消? PHP7/HHVM(JIT)とか使えばいっか!
アプリケーション開発サイクル 命名規則(CoC)とケーススタイル データベーステーブル、カラム名は スネークケーススタイル(hoge_fuga) テーブル名は複数形・モデルクラス名は単数形 PHPコーディングはPSR-2準拠(Laravel5.1準拠) メソッド・変数名は文脈で単数・複数形を使い分け CSSのid,classはチェインケーススタイル(hoge-fuga) ※CSSはSMACCSに準拠,CSSプリプロセッサはLess
アプリケーション開発サイクル Laravelインストール $ composer create-project laravel/laravel --prefer-dist $ cd laravel;
git init # とりあえずリポ作成 $ composer install # frameworkのダウンロード $ gulp # ビルド(transpile,minify,uglify CSS/Javascript) $ artisan serve # PHP buildin server起動(port:8000) create-project使うと、passwordハッシュのソルトとか自動生成してくれて便利 Javascript/CSSライブラリはbowerとnpmでパッケージ管理
アプリケーション開発サイクル データベースマイグレーション Schema Builderでテーブル定義を書く。 $ artisan make:migration create_users_table $ artisan
db:migrate 初期データの投入はseederを書く(モデルクラス定義後)。 $ artisan db:seed
アプリケーション開発サイクル 各テーブルのORMクラスを生成 $ artisan make:model User 関連もORMクラスに定義 hasOne(),hasMany(), belongsTo(),belongsToMany()... Lazy
Eager Loadingをサポート
アプリケーション開発サイクル URI設計とルーティング設定 URIとコントローラのメソッドを結びつける Route::get(‘/projects’, ‘ProjectController@index’); Route::get(‘/projects/{id}/show’, ‘ProjectController@show’); Pretty URLで記述できる。 middlewareと呼ばれるフィルタを自在に設定可能。
アプリケーション開発サイクル コントローラを書く コントローラの役目は、 (1)リクエストをバリデーション(バリデータをDIできる) (2)ビジネスロジックを実行 (3)表示に必要なデータをViewへ渡すまで。 コンストラクタでサービスの実装をDIする。 public function __construct(ServiceInterface
$service) fat controllerにしない。 ビジネスロジックはサービス層で、設計と実装を分離する。 UnitTestがしやすくなる。
アプリケーション開発サイクル PHPUnit Laravelのテスティングクラスでテストケースを記述 Webページのインタラクティブな動作も記述可能(visit,click,see) フレームワークのメソッドをMockできる(Mockery)。 未完成のサービスはDIでMockをbindする。 ファクトリを使ったテストデータ作成(Faker) データベースもテストケースごとにリセット可能(ロールバック)。 PsySHでインタラクティブなテストも可能 TDD(テストファースト)からBDD(スペックファースト)へ
開発とはオールレッドをオールグリーンに変えていく作業。
ステージング環境の構築 VirtualBox+Vagrantで プロダクション環境と 同じOS、ミドルウェアを構成管理 プロビジョニングはAnsibleを利用 デプロイメントもAnsibleを利用 ※デプロイメントスタイルはCapistranoスタイル QA(Quality Authroity)向けにも提供
脆弱性検査とパフォーマンス検査 Vaddy+New Relic どちらも無償版があるが、 実務では有償版でないと十分機能しないかも。
CI(Continuous Integration) Gitリポジトリのmasterへpush/mergeをトリガー ステージング環境をVagrant,Dockerで 一時的に構築しプロビジョニング Gitリポジトリからmasterをarchive/export ビルド ユニットテスト実行 (結果を通知 HipChat,Slackとかへ)
通過すれば、Vaddyで脆弱性検査 ステージング環境を破棄 プロダクション版リリース これらをCIで自動化したい。 TravisCI,Jenkins,CircleCI