Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
はじめよう CakePHP3
Search
Kenya Yamaguchi
June 19, 2015
Technology
0
400
はじめよう CakePHP3
PHP Framework 最新バージョン使ってみた LT で CakePHP3で話しました。
http://connpass.com/event/16016/
Kenya Yamaguchi
June 19, 2015
Tweet
Share
More Decks by Kenya Yamaguchi
See All by Kenya Yamaguchi
DevOps勉強会 LT_2014_11_26
ken880guchi
0
110
株式会社 Loco Partners の社内開発 LT 2014年11月18
ken880guchi
2
88
Hubot×ChatOps勉強会
ken880guchi
1
1.3k
Other Decks in Technology
See All in Technology
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
18
17k
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
200
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
生成AIのガバナンスの全体像と現実解
fnifni
1
190
AI時代のデータセンターネットワーク
lycorptech_jp
PRO
1
290
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
270
ハイテク休憩
sat
PRO
2
170
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
360
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
120
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
170
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
210
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
570
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Designing for Performance
lara
604
68k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
450
Code Review Best Practice
trishagee
65
17k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Building Your Own Lightsaber
phodgson
103
6.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Transcript
͡ΊΑ͏ CakePHP3
ࣗݾհ גࣜձࣾ Loco Partners @ken880guchi PHPer
CakePHP ͬͨ͜ͱ͋Δʁ
CakePHP 3 ͍͍ͨͱࢥ͍ͬͯΔਓ
CakePHP3 Λ͙࢝͢ΊΔڥߏங ※ Vagrant + VirturlBox ղΒͳ͍ਓ OR Ͱߦ͖͍ͨਓ PHP
5.4.16 Ҏ্ HTTP Server (Apache, Nginx) mbstring extension intl extension composer ͷΠϯετʔϧ
CakePHP3 Λ͙࢝͢ΊΔڥߏங ※Vagrant + VirturlBox Λগ͠ղΔ FriendsOfCake/vagrant-chef GitHub (https://github.com/FriendsOfCake/vagrant-chef) Cakebox
GitHub (https://github.com/alt3/cakebox) ؛ా͞Μ͕ Cakebox ʹ͍ͭͯհ͞Ε͍ͯΔهࣄ http://blog.open.tokyo.jp/2015/04/19/cakebox-is-awesome.html
CakePHP3 Install composer create-project --prefer-dist cakephp/app sandbox
֤σΟϨΫτϦ sandboxs ᵓᴷᴷ README.md ᵓᴷᴷ bin ᵓᴷᴷ composer.json ᵓᴷᴷ config
(֤छઃఆϑΝΠϧ) ᵓᴷᴷ index.php ᵓᴷᴷ logs (ϩά֨ೲ) ᵓᴷᴷ phpunit.xml.dist ᵓᴷᴷ plugins ᵓᴷᴷ src ᵓᴷᴷ tests ᵓᴷᴷ tmp ᵓᴷᴷ vendor
ىಈͯ͠ΈΔ λʔϛφϧ͔ΒԼهͷίϚϯυΛ࣮ߦ > bin/cake server --------------------------------------------------------------- App : src Path:
/var/www/sandbox/src/ DocumentRoot: /var/www/sandbox/webroot --------------------------------------------------------------- built-in server is running in http://localhost:8765/ You can exit with `CTRL-C` ϒϥβͰԼهͷ URL ʹΞΫηε > http://localhost:8765/
͍ͭͷ
Controller ͜Ε·Ͱͷ CakePHPͱมΘΒͳ͍ ΞΫηεम০ࢠʹ public Λ͚͍ͭͯΔͷ͕ࣗಈ తʹΞΫγϣϯͱͯ͠ѻΘΕΔɻ
Controller namespace App\Controller; use Cake\Network\Exception\NotFoundException; class NipposController extends AppController {
// ΞΫγϣϯ public function add() { // ॲཧίʔυ } // ඇΞΫγϣϯ public function __logic() { // ॲཧίʔυ } }
Model ϏδωεϩδοΫͷهड़༻Ϋϥε Table ͱ Entity ͷ 2 ͭʹ͔Εͨɻ ࿈ྻͰͳ͘ɺ ΦϒδΣΫτΛฦ٫͢ΔΑ͏
ʹͳͬͨɻ
Model namespace App\Model\Table; use Cake\ORM\Table; class NipposTable extends Table {
public function initialize(array $config) { // ॲཧίʔυ } }
View ॻ͖ํࣗମಛʹมΘΒͣ src/View/ ԼͰͳ͘ src/Template Լʹ View Λ༻ҙ͢ΔΑ͏ʹͳͬͨ Elements
Layout ͳͲͷ͍ํҎલ·Ͱͱಉ ͡
ͬͯΈͯຯʹϋϚͬͨͱ͜ Form->input ϝιουʹ [div => false] ͷ ΦϓγϣϯΛ༩͑ͯɺdiv ͕ੜ͞Ε ͯ͠·͏ɻɻɻ
ͬͯΈͯຯʹϋϚͬͨͱ͜ # config σΟϨΫτϦԼʹςϯϓϨʔτ༻ϑΝΠϧͷ࡞ > touch config/custom_form.php # config/custom_form.php
ʹԼهͷΑ͏ʹهࡌ return [ 'inputContainer' => '{{content}}', ];
ͬͯΈͯຯʹྑ͔ͬͨ͜ͱ CakePHP 3 Λ༻͢Δҝʹɺ5.4.16 Ҏ্ͷ༻͕ ඞਢʹͳͬͨ͜ͱʹΑΓɺArray Short Syntax short_open_tag
͕σϑΥϧτͰ༻Ͱ͖ΔΑ͏ʹ ͳͬͨɻ
ΑΓৄ͘͠ͳΔͨΊʹ CheatSheet ͷ׆༻ http://cake3.codaxis.com/ Release Note @mark_story ͷΥον http://cakephp.org/
ͷԼͷํʹ͋Δɻ