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
940
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
140
LaravelでTDDを体験しよう #phpcon2018
omoon
1
4k
Laravel でアプリケーションを開発し Heroku で公開するまでの一部始終 #laravel_osaka
omoon
3
1.4k
Why don't you try "Query Builder"
omoon
1
2.9k
素晴らしき Carbon の世界 〜あなたも今日から日時マスター〜
omoon
4
14k
omoon.org の裏側 〜FuelPHP の task 活用例〜
omoon
0
150
FuelPHP をさわってみて #phpkansai
omoon
2
190
Other Decks in Technology
See All in Technology
Copilotの力を実感!3ヶ月間の生成AI研修の試行錯誤&成功事例をご紹介。果たして得たものとは・・?
ktc_shiori
0
340
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
54k
comilioとCloudflare、そして未来へと向けて
oliver_diary
6
440
2025年に挑戦したいこと
molmolken
0
160
新卒1年目、はじめてのアプリケーションサーバー【IBM WebSphere Liberty】
ktgrryt
0
100
機械学習を「社会実装」するということ 2025年版 / Social Implementation of Machine Learning 2025 Version
moepy_stats
5
970
Formal Development of Operating Systems in Rust
riru
1
420
re:Invent 2024のふりかえり
beli68
0
110
GeometryReaderやスクロールを用いた表現と紐解き方
fumiyasac0921
0
100
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
350
iPadOS18でフローティングタブバーを解除してみた
sansantech
PRO
1
130
When Windows Meets Kubernetes…
pichuang
0
300
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
Building Your Own Lightsaber
phodgson
104
6.2k
How GitHub (no longer) Works
holman
312
140k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Navigating Team Friction
lara
183
15k
Adopting Sorbet at Scale
ufuk
74
9.2k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Agile that works and the tools we love
rasmusluckow
328
21k
Mobile First: as difficult as doing things right
swwweet
222
9k
Being A Developer After 40
akosma
89
590k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Speed Design
sergeychernyshev
25
740
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 ҆৺͠·ͨ͠
#jawsfesta ࠓ͢͜ͱ
#jawsfesta ࠓ͢͜ͱ wΫϥυʹ·ͭΘΔݴ༿ͷཧ
#jawsfesta ࠓ͢͜ͱ wΫϥυʹ·ͭΘΔݴ༿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JDF
#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 ͋Γ͕ͱ͏͍͟͝·ͨ͠