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
930
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.9k
素晴らしき Carbon の世界 〜あなたも今日から日時マスター〜
omoon
4
14k
omoon.org の裏側 〜FuelPHP の task 活用例〜
omoon
0
140
FuelPHP をさわってみて #phpkansai
omoon
2
180
Other Decks in Technology
See All in Technology
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
生成AIのガバナンスの全体像と現実解
fnifni
1
180
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
WACATE2024冬セッション資料(ユーザビリティ)
scarletplover
0
190
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
420
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
730
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
520
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
180
2024年にチャレンジしたことを振り返るぞ
mitchan
0
130
Featured
See All Featured
Making Projects Easy
brettharned
116
5.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
The Cult of Friendly URLs
andyhume
78
6.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Building Your Own Lightsaber
phodgson
103
6.1k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Documentation Writing (for coders)
carmenintech
66
4.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How GitHub (no longer) Works
holman
311
140k
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 ژηϥυʔϜͱฉ͍ͯ
#jaws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ྨͷͳ͠Ͱͨ͠ w*BB4 *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 ͋Γ͕ͱ͏͍͟͝·ͨ͠