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
グローバル展開を見据えたサービスにおける機械翻訳プラクティス / dp-ai-translating
cyberagentdevelopers
PRO
1
150
話題のGraphRAG、その可能性と課題を理解する
hide212131
4
1.5k
Gradle: The Build System That Loves To Hate You
aurimas
2
150
よくわからんサービスについての問い合わせが来たときの強い味方 Amazon Q について
kazzpapa3
0
220
とあるユーザー企業におけるリスクベースで考えるセキュリティ業務のお話し
4su_para
3
330
[AWS JAPAN 生成AIハッカソン] Dialog の紹介
yoshimi0227
0
150
現地でMeet Upをやる場合の注意点〜反省点を添えて〜
shotashiratori
0
530
MAMを軸とした動画ハンドリングにおけるAI活用前提の整備と次世代ビジョン / abema-ai-mam
cyberagentdevelopers
PRO
1
120
Apple/Google/Amazonの決済システムの違いを踏まえた定期購読課金システムの構築 / abema-billing-system
cyberagentdevelopers
PRO
1
220
新卒1年目が向き合う生成AI事業の開発を加速させる技術選定 / ai-web-launcher
cyberagentdevelopers
PRO
7
1.5k
Amazon FSx for NetApp ONTAPを利用するにあたっての要件整理と設計のポイント
non97
1
160
10分でわかるfreeeのQA
freee
1
3.4k
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
93
13k
4 Signs Your Business is Dying
shpigford
180
21k
Testing 201, or: Great Expectations
jmmastey
38
7k
Navigating Team Friction
lara
183
14k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
The Pragmatic Product Professional
lauravandoore
31
6.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Designing for Performance
lara
604
68k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Adopting Sorbet at Scale
ufuk
73
9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.2k
Making Projects Easy
brettharned
115
5.9k
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/
ͷԼͷํʹ͋Δɻ