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
87
Hubot×ChatOps勉強会
ken880guchi
1
1.3k
Other Decks in Technology
See All in Technology
強いチームと開発生産性
onk
PRO
35
11k
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
110
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
【令和最新版】AWS Direct Connectと愉快なGWたちのおさらい
minorun365
PRO
5
760
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
500
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
540
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
950
Zennのパフォーマンスモニタリングでやっていること
ryosukeigarashi
0
150
AIチャットボット開発への生成AI活用
ryomrt
0
170
Why App Signing Matters for Your Android Apps - Android Bangkok Conference 2024
akexorcist
0
130
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
RailsConf 2023
tenderlove
29
900
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Git: the NoSQL Database
bkeepers
PRO
427
64k
4 Signs Your Business is Dying
shpigford
180
21k
The Cult of Friendly URLs
andyhume
78
6k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Designing for Performance
lara
604
68k
The Cost Of JavaScript in 2023
addyosmani
45
6.8k
How GitHub (no longer) Works
holman
310
140k
Side Projects
sachag
452
42k
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/
ͷԼͷํʹ͋Δɻ