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
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
200
スタートアップで取り組んでいるAzureとMicrosoft 365のセキュリティ対策/How to Improve Azure and Microsoft 365 Security at Startup
yuj1osm
0
230
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
210
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
170
UI State設計とテスト方針
rmakiyama
2
740
非機能品質を作り込むための実践アーキテクチャ
knih
5
1.6k
Google Cloud で始める Cloud Run 〜AWSとの比較と実例デモで解説〜
risatube
PRO
0
110
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
1
230
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
280
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
170
20241220_S3 tablesの使い方を検証してみた
handy
4
660
Featured
See All Featured
For a Future-Friendly Web
brad_frost
175
9.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Faster Mobile Websites
deanohume
305
30k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
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/
ͷԼͷํʹ͋Δɻ