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
Dive into the Cloud with our buddy, lovely PHP!
Search
omoon
September 28, 2013
Technology
0
920
Dive into the Cloud with our buddy, lovely PHP!
PHPでクラウドの世界へ飛び込もう。
JAWS FESTA Kansai 2013 でのスライドです。
omoon
September 28, 2013
Tweet
Share
More Decks by omoon
See All by omoon
My First Adobe XD Plugin
omoon
0
130
LaravelでTDDを体験しよう #phpcon2018
omoon
1
3.9k
Laravel でアプリケーションを開発し Heroku で公開するまでの一部始終 #laravel_osaka
omoon
3
1.3k
Why don't you try "Query Builder"
omoon
1
2.8k
素晴らしき Carbon の世界 〜あなたも今日から日時マスター〜
omoon
4
14k
omoon.org の裏側 〜FuelPHP の task 活用例〜
omoon
0
140
FuelPHP をさわってみて #phpkansai
omoon
2
180
Other Decks in Technology
See All in Technology
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
190
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
300
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
200
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
370
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.6k
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
110
Application Development WG Intro at AppDeveloperCon
salaboy
0
180
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
隣接領域をBeyondするFinatextのエンジニア組織設計 / beyond-engineering-areas
stajima
1
270
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Designing for Performance
lara
604
68k
How to Ace a Technical Interview
jacobian
276
23k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
The World Runs on Bad Software
bkeepers
PRO
65
11k
It's Worth the Effort
3n
183
27k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Automating Front-end Workflow
addyosmani
1366
200k
Thoughts on Productivity
jonyablonski
67
4.3k
Transcript
%JWFJOUPUIF$MPVEXJUIPVSCVEEZ MPWFMZ1)1 ؔ1)1ษڧձJO+"84'&45",BOTBJ 4FQUFNCFSUI 4PUBSP0.63" !PNPPO
#jawsfesta "CPVU.F
#jawsfesta "CPVU.F w4PUBSP0.63"
#jawsfesta "CPVU.F w4PUBSP0.63" wגࣜձࣾλοϓ
#jawsfesta "CPVU.F w4PUBSP0.63" wגࣜձࣾλοϓ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ͱ͔ʣ
#jawsfesta "CPVU.F w4PUBSP0.63" wגࣜձࣾλοϓ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ͱ͔ʣ wMPWFOPPEMFT
#jawsfesta "CPVU.F w4PUBSP0.63" wגࣜձࣾλοϓ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ͱ͔ʣ wMPWFOPPEMFT wPNPPOPSH
#jawsfesta "CPVU.F w4PUBSP0.63" wגࣜձࣾλοϓ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ͱ͔ʣ wMPWFOPPEMFT wPNPPOPSH w!PNPPO
#jawsfesta "CPVU.F w4PUBSP0.63" wגࣜձࣾλοϓ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ͱ͔ʣ wMPWFOPPEMFT wPNPPOPSH w!PNPPO
#jawsfesta ژηϥυʔϜͱฉ͍ͯ
#jawsfesta
#jawsfesta ҆৺͠·ͨ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4 *OGSBTUSVDUVSFBTB4FSWJDF
#jawsfesta Ϋϥυͭͷྨͷͳ͠Ͱͨ͠ w*BB4 *OGSBTUSVDUVSFBTB4FSWJDF w1BB4 1MBUGPSNBTB4FSWJDF
#jawsfesta Ϋϥυͭͷྨͷͳ͠Ͱͨ͠ w*BB4 *OGSBTUSVDUVSFBTB4FSWJDF w1BB4 1MBUGPSNBTB4FSWJDF w4BB4 4PGUXBSFBTB4FSWJDF
#jawsfesta ͑͑ͷʁΘΔ͍ͷʁ
#jawsfesta ࣌ͱ߹ʹΑΔ
#jawsfesta ߟ͑ΒΕΔϝϦοτʢ͔ͳΓେࡶʣ
#jawsfesta ߟ͑ΒΕΔϝϦοτʢ͔ͳΓେࡶʣ w͙͢Ͱ͖Δ
#jawsfesta ߟ͑ΒΕΔϝϦοτʢ͔ͳΓେࡶʣ w͙͢Ͱ͖Δ wͳ͔ͬͨ͜ͱʹͰ͖Δ
#jawsfesta ߟ͑ΒΕΔϝϦοτʢ͔ͳΓେࡶʣ w͙͢Ͱ͖Δ wͳ͔ͬͨ͜ͱʹͰ͖Δ wίετ
#jawsfesta ߟ͑ΒΕΔσϝϦοτʢ͔ͳΓେࡶʣ
#jawsfesta ߟ͑ΒΕΔσϝϦοτʢ͔ͳΓେࡶʣ w࠷ޙͷͱ͜ΖͰ༥௨͕͖͔ͳ͍
#jawsfesta ߟ͑ΒΕΔσϝϦοτʢ͔ͳΓେࡶʣ w࠷ޙͷͱ͜ΖͰ༥௨͕͖͔ͳ͍ wӳޠʂ
#jawsfesta ߟ͑ΒΕΔσϝϦοτʢ͔ͳΓେࡶʣ w࠷ޙͷͱ͜ΖͰ༥௨͕͖͔ͳ͍ wӳޠʂ wίετ
#jawsfesta ࣌ͱ߹ʹΑΔ
#jawsfesta ·ͣͨΊͯ͠Έ·͠ΐ͏
#jawsfesta
#jawsfesta
#jawsfesta "CPVU.F
#jawsfesta "CPVU.F
#jawsfesta ͨΊͯ͠ΈΔʹ͋ͨͬͯ
#jawsfesta ͓͖ͬͯ͘पลٕज़
#jawsfesta TTI
#jawsfesta % ssh
[email protected]
[email protected]
's password:
#jawsfesta % ssh
[email protected]
[email protected]
's password:
#jawsfesta TTI
#jawsfesta TTI wύεϫʔυΘͣʹ
#jawsfesta TTI wύεϫʔυΘͣʹ wݤͷϖΞΛͭ͘Γ
#jawsfesta TTI wύεϫʔυΘͣʹ wݤͷϖΞΛͭ͘Γ wͻͱͭൿີ
#jawsfesta TTI wύεϫʔυΘͣʹ wݤͷϖΞΛͭ͘Γ wͻͱͭൿີ wͻͱͭ૬खʹ͢
#jawsfesta TTI wύεϫʔυΘͣʹ wݤͷϖΞΛͭ͘Γ wͻͱͭൿີ wͻͱͭ૬खʹ͢ wΓͱΓ͢Δͱ͖ʹর߹ͯ͠
#jawsfesta TTI wύεϫʔυΘͣʹ wݤͷϖΞΛͭ͘Γ wͻͱͭൿີ wͻͱͭ૬खʹ͢ wΓͱΓ͢Δͱ͖ʹর߹ͯ͠ wΞΫηε͍͍ͯ͠Αʙ
#jawsfesta
#jawsfesta
#jawsfesta
#jawsfesta
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ"84ʣ
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ"84ʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ"84ʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ wαʔόͱͷ௨৴ΩʔϖΞΛͬͨTTI
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ"84ʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ wαʔόͱͷ௨৴ΩʔϖΞΛͬͨTTI wαʔόଆͰHJUQVMM
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ"84ʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ wαʔόͱͷ௨৴ΩʔϖΞΛͬͨTTI wαʔόଆͰHJUQVMM wDPNQPTFSJOTUBMMͳͲ
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ1BHPEB#PYʣ
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ1BHPEB#PYʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ1BHPEB#PYʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ wखݩʹHJUDMPOF
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ1BHPEB#PYʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ wखݩʹHJUDMPOF w1BHPEB#PYͷϦϙδτϦΛHJUSFNPUFBEE
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ1BHPEB#PYʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ wखݩʹHJUDMPOF w1BHPEB#PYͷϦϙδτϦΛHJUSFNPUFBEE wαʔόͱͷ௨৴ΩʔϖΞΛͬͨTTI
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ1BHPEB#PYʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ wखݩʹHJUDMPOF w1BHPEB#PYͷϦϙδτϦΛHJUSFNPUFBEE wαʔόͱͷ௨৴ΩʔϖΞΛͬͨTTI wαʔόଆʹHJUQVTI
#jawsfesta ίʔυͷσϓϩΠͷ̍Ҋʢ1BHPEB#PYʣ w(JUͷϦϞʔτϦϙδτϦΛ࡞Δ wखݩʹHJUDMPOF w1BHPEB#PYͷϦϙδτϦΛHJUSFNPUFBEE wαʔόͱͷ௨৴ΩʔϖΞΛͬͨTTI wαʔόଆʹHJUQVTI wDPNQPTFSJOTUBMMͳͲ
#jawsfesta αϯϓϧίʔυ
#jawsfesta αϯϓϧίʔυ wIUUQTHJUIVCDPN1)1&OHJOFFST5SBJOJOH#PPL QIQ@NPPL@TBNQMF
#jawsfesta αϯϓϧίʔυ wIUUQTHJUIVCDPN1)1&OHJOFFST5SBJOJOH#PPL QIQ@NPPL@TBNQMF wσϞ͠·͢
#jawsfesta HJUDMPOF % git clone
[email protected]
:PHP-‐Engineers-‐Training-‐Book/php_mook_sample.git Cloning into 'php_mook_sample'... remote:
Counting objects: 37, done. remote: Compressing objects: 100% (33/33), done. remote: Total 37 (delta 0), reused 37 (delta 0) Receiving objects: 100% (37/37), 1.02 MiB | 491 KiB/s, done.
#jawsfesta
#jawsfesta ▾ php_mook_sample/ ▾ bin/
phpmig* -‐> /Users/omoon/Documents/php_mook_sample/vendor/davedevelopment/phpmig/bin/phpmig ▾ config/ development.php pagoda.php ▸ logs/ ▾ migrations/ 20130711105053_CreateInitialTables.php* ▾ public/ ▸ assets/ index.php ▾ vendor/ ▸ composer/ ▸ davedevelopment/ ▸ doctrine/ ▸ pimple/ ▸ psr/ ▸ silex/ ▸ symfony/ ▸ twig/ autoload.php ▾ views/ index.twig Boxfile composer.json composer.lock composer.phar* phpmig.php
#jawsfesta 1 { 2 "require": {
3 "silex/silex": "1.*", 4 "doctrine/dbal": "2.2.*", 5 "twig/twig": "~1.8", 6 "davedevelopment/phpmig": "*" 7 }, 8 "config": { 9 "bin-‐dir": "bin/" 10 } 11 }
#jawsfesta DPNQPTFSJOTUBMM $ curl -‐s http://getcomposer.org/installer | php #!/usr/bin/env
php All settings correct for using Composer Downloading... Composer successfully installed to: /Users/omoon/Documents/php_mook_sample/ composer.phar Use it: php composer.phar
#jawsfesta DPNQPTFSJOTUBMM % php composer.phar install Loading composer repositories
with package information ... ʢུʣ ... symfony/event-‐dispatcher suggests installing symfony/dependency-‐injection () symfony/http-‐kernel suggests installing symfony/browser-‐kit () symfony/http-‐kernel suggests installing symfony/dependency-‐injection () symfony/http-‐kernel suggests installing symfony/finder () silex/silex suggests installing symfony/browser-‐kit (>=2.3,<2.4-‐dev) silex/silex suggests installing symfony/css-‐selector (>=2.3,<2.4-‐dev) silex/silex suggests installing symfony/dom-‐crawler (>=2.3,<2.4-‐dev) silex/silex suggests installing symfony/form (>=2.3,<2.4-‐dev) Generating autoload files
#jawsfesta 1 <?php 2 require __DIR__ . '/../vendor/autoload.php'; 3
4 $app = new Silex\Application(); 5 6 $app-‐>register(new Silex\Provider\TwigServiceProvider(), array( 7 'twig.path' => __DIR__.'/../views', 8 )); 9 10 // σʔλϕʔεଓใͷಡࠐ 11 $env = getenv('APP_ENV') ?: 'development'; 12 $config = require __DIR__ . "/../config/$env.php"; 13 $app-‐>register(new Silex\Provider\DoctrineServiceProvider(), array( 14 'db.options' => $config['db'], 15 )); 16 17 // τοϓը໘ 18 $app-‐>get('/', function(Silex\Application $app) { 19 $posts = $app['db']-‐>fetchAll(' 20 SELECT name, message, unix_timestamp(created) as created 21 FROM posts ORDER BY created DESC LIMIT 5 22 '); 23 return $app['twig']-‐>render('index.twig', array( 24 'posts' => $posts, 25 )); 26 }); 27 28 // ߘॲཧ 29 $app-‐>post('/speak', function(Silex\Application $app) { 30 $name = $app['request']-‐>get('name'); 31 $message = $app['request']-‐>get('message'); 32 if ($name && $message) { 33 $app['db']-‐>insert('posts', array('name' => $name, 'message' => $message)); 34 } 35 return $app-‐>redirect('/'); 36 }); 37 38 $app-‐>run();
#jawsfesta 1 <?php 2 require __DIR__ . '/../vendor/autoload.php'; 3
4 $app = new Silex\Application(); 5 6 $app-‐>register(new Silex\Provider\TwigServiceProvider(), array( 7 'twig.path' => __DIR__.'/../views', 8 )); 9 10 // σʔλϕʔεଓใͷಡࠐ 11 $env = getenv('APP_ENV') ?: 'development'; 12 $config = require __DIR__ . "/../config/$env.php"; 13 $app-‐>register(new Silex\Provider\DoctrineServiceProvider(), array( 14 'db.options' => $config['db'], 15 )); 16 17 // τοϓը໘ 18 $app-‐>get('/', function(Silex\Application $app) { 19 $posts = $app['db']-‐>fetchAll(' 20 SELECT name, message, unix_timestamp(created) as created 21 FROM posts ORDER BY created DESC LIMIT 5 22 '); 23 return $app['twig']-‐>render('index.twig', array( 24 'posts' => $posts, 25 )); 26 }); 27 28 // ߘॲཧ 29 $app-‐>post('/speak', function(Silex\Application $app) { 30 $name = $app['request']-‐>get('name'); 31 $message = $app['request']-‐>get('message'); 32 if ($name && $message) { 33 $app['db']-‐>insert('posts', array('name' => $name, 'message' => $message)); 34 } 35 return $app-‐>redirect('/'); 36 }); 37 38 $app-‐>run();
#jawsfesta 1 <?php 2 require __DIR__ . '/../vendor/autoload.php'; 3
4 $app = new Silex\Application(); 5 6 $app-‐>register(new Silex\Provider\TwigServiceProvider(), array( 7 'twig.path' => __DIR__.'/../views', 8 ));
#jawsfesta 10 // σʔλϕʔεଓใͷಡࠐ 11 $env = getenv('APP_ENV') ?: 'development';
12 $config = require __DIR__ . "/../config/$env.php"; 13 $app-‐>register(new Silex\Provider\DoctrineServiceProvider(), array( 14 'db.options' => $config['db'], 15 ));
#jawsfesta 17 // τοϓը໘ 18 $app-‐>get('/', function(Silex\Application $app) { 19
$posts = $app['db']-‐>fetchAll(' 20 SELECT name, message, unix_timestamp(created) as created 21 FROM posts ORDER BY created DESC LIMIT 5 22 '); 23 return $app['twig']-‐>render('index.twig', array( 24 'posts' => $posts, 25 )); 26 });
#jawsfesta 1 { 2 "require": {
3 "silex/silex": "1.*", 4 "doctrine/dbal": "2.2.*", 5 "twig/twig": "~1.8", 6 "davedevelopment/phpmig": "*" 7 }, 8 "config": { 9 "bin-‐dir": "bin/" 10 } 11 }
#jawsfesta 28 // ߘॲཧ 29 $app-‐>post('/speak', function(Silex\Application $app) { 30
$name = $app['request']-‐>get('name'); 31 $message = $app['request']-‐>get('message'); 32 if ($name && $message) { 33 $app['db']-‐>insert('posts', array('name' => $name, 'message' => $message)); 34 } 35 return $app-‐>redirect('/'); 36 });
#jawsfesta 38 $app-‐>run();
#jawsfesta ͱʹ͔ͨ͘Ίͯ͠Έ·͠ΐ͏
#jawsfesta ͋Γ͕ͱ͏͍͟͝·ͨ͠