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
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!座学①
siyuanzh09
0
110
メールヘッダーを見てみよう
hinono
0
110
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
360
Cloudflareで実現する AIエージェント ワークフロー基盤
kmd09
0
290
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
1
16k
Accessibility Inspectorを活用した アプリのアクセシビリティ向上方法
hinakko
0
180
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
Docker Desktop で Docker を始めよう
zembutsu
PRO
0
180
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
110
DMMブックスへのTipKit導入
ttyi2
1
110
embedパッケージを深掘りする / Deep Dive into embed Package in Go
task4233
1
220
Azureの開発で辛いところ
re3turn
0
240
Featured
See All Featured
Docker and Python
trallard
43
3.2k
Why Our Code Smells
bkeepers
PRO
335
57k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Agile that works and the tools we love
rasmusluckow
328
21k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
A designer walks into a library…
pauljervisheath
205
24k
How STYLIGHT went responsive
nonsquared
96
5.3k
Bash Introduction
62gerente
610
210k
Mobile First: as difficult as doing things right
swwweet
222
9k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
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/
ͷԼͷํʹ͋Δɻ