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
omoon.org の裏側 〜FuelPHP の task 活用例〜
Search
omoon
October 12, 2013
Technology
200
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
omoon.org の裏側 〜FuelPHP の task 活用例〜
2013/10/12 の FuelPHP&CodeIgniter ユーザの集い LT 資料です。
omoon
October 12, 2013
More Decks by omoon
See All by omoon
My First Adobe XD Plugin
omoon
0
170
LaravelでTDDを体験しよう #phpcon2018
omoon
1
4.5k
Laravel でアプリケーションを開発し Heroku で公開するまでの一部始終 #laravel_osaka
omoon
3
1.5k
Why don't you try "Query Builder"
omoon
1
3k
素晴らしき Carbon の世界 〜あなたも今日から日時マスター〜
omoon
4
14k
Dive into the Cloud with our buddy, lovely PHP!
omoon
0
1.2k
FuelPHP をさわってみて #phpkansai
omoon
2
240
Other Decks in Technology
See All in Technology
AndroidでHDRメディアを「壊さずに」扱う
chigichan24
0
400
bet_ai_day_2026_session02
agenticsec
1
980
データエンジニアリングワークショップ:Auto LoaderとSparkで学ぶデータパイプライン構築
databricksjapan
PRO
0
160
From Vanilla Kubernetes to a Batteries-Included Platform: Developer Experience at 1,300+ Clusters
yosshi_
0
480
JAWS-UG初心者支部#88わいわい初心塾(夏休みの宿題やったかGit編)
otsuki
0
130
[DroidKaigi 2026] Making UI specifications visible: Android UI development in the AI agent era supported by Compose Screenshot Testing and galleries
syarihu
0
570
少人数データチームのDevin活用実践事例
runandy16
2
440
推論の観測、できていますか? 〜 Google Cloud Gemini Enterprise Agent Platformで 3つの Gemini モデルを実測して踏んだ、評価の罠 〜
shukob
PRO
0
150
grill-me(grilling):AI駆動開発を超助けてくれるSkill / grill me
mathbullet
0
110
Bet AI Day 2026丨How We Bet AI: AIとともに働く場をつくる
layerx
PRO
2
2.3k
Guerilla InnerSource in enterprises, during the AI hype
onenashev
PRO
0
150
いま、生成AIにKaggleをどこまで 任せられるか — ROGIIコンペでの進め方とTips
k951286
3
1.4k
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
430
Faster Mobile Websites
deanohume
310
32k
The Curious Case for Waylosing
cassininazir
1
490
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
970
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
270
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
190
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
490
How to Ace a Technical Interview
jacobian
281
24k
Transcript
PNPPOPSHͷཪଆ 'VFM1)1ͷUBTL׆༻ྫ 'VFM1)1ˍ$PEF*HOJUFSϢʔβͷू͍ʢ'VFM1)1౦ژษڧձɺ$PEF*HOJUFSUBMLʣ 0DUPCFS 4PUBSP0.63" !PNPPO
"CPVU.F
"CPVU.F w4PUBSP0.63"
"CPVU.F w4PUBSP0.63" wେࡕ͔Βདྷ·ͨ͠
"CPVU.F w4PUBSP0.63" wେࡕ͔Βདྷ·ͨ͠ w,BOTBJ1)16TFST(SPVQ4UB⒎
"CPVU.F w4PUBSP0.63" wେࡕ͔Βདྷ·ͨ͠ w,BOTBJ1)16TFST(SPVQ4UB⒎ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ʣ
"CPVU.F w4PUBSP0.63" wେࡕ͔Βདྷ·ͨ͠ w,BOTBJ1)16TFST(SPVQ4UB⒎ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ʣ wPNPPOPSH
"CPVU.F w4PUBSP0.63" wେࡕ͔Βདྷ·ͨ͠ w,BOTBJ1)16TFST(SPVQ4UB⒎ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ʣ wPNPPOPSH w!PNPPO
"CPVU.F w4PUBSP0.63" wେࡕ͔Βདྷ·ͨ͠ w,BOTBJ1)16TFST(SPVQ4UB⒎ w1)1ྺ΄Ͳʢ࠷ۙ'VFM1)1ʣ wPNPPOPSH w!PNPPO
ΊΜͲ͕͘͞Γ
None
None
"CPVU.F
"CPVU.F
ϑϨʔϜϫʔΫΛͬͨ αϯϓϧΞϓϦέʔγϣϯ
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();
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();
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(); ͳΜ͔͢Έ·ͤΜ
'VFM1)1ͱͷͳΕͦΊ
None
None
None
None
None
͓͖Ͱ͢Ͷ
ଞʹ
None
࠷ۙ
None
None
None
None
None
+40/ͰΓͱΓ
None
͋Γ͕ͱ͏
ͯ͞
PNPPOPSH
None
PNPPOPSH
PNPPOPSH w͝Ζελʔτ
PNPPOPSH w͝Ζελʔτ wࣸਅͱҰߦίϝϯτ͚ͩ
PNPPOPSH w͝Ζελʔτ wࣸਅͱҰߦίϝϯτ͚ͩ w࠷ॳ)5.- '51Ξοϓϩʔυ
ΊΜͲ͕͘͞Γ
None
None
None
؆қԽͷྺ࢙
؆қԽͷྺ࢙ w'MJDLS
؆қԽͷྺ࢙ w'MJDLS w1)1 .Z42-
؆қԽͷྺ࢙ w'MJDLS w1)1 .Z42- w'MJDLS &ZF'J
؆қԽͷྺ࢙ w'MJDLS w1)1 .Z42- w'MJDLS &ZF'J wಠࣗDSPOKPC
None
ΦϨΦϨͳͷͰ͠ͳ͍
None
5BTLTBSFDMBTTFTUIBUDBOCFSVOUISPVHIUIFDPNNBOEMJOFPS TFUVQBTBDSPOKPC5IFZBSFHFOFSBMMZVTFEGPSCBDLHSPVOE QSPDFTTFT UJNFEUBTLTBOENBJOUFOBODFUBTLT5BTLTDBODBMMT NPEFMTBOEPUIFSDMBTTFTKVTUMJLFDPOUSPMMFST
5BTLT
5BTLT wίϚϯυϥΠϯ͔ΒݺΔ
5BTLT wίϚϯυϥΠϯ͔ΒݺΔ wDSPOKPCͱͯ͑͠Δ
5BTLT wίϚϯυϥΠϯ͔ΒݺΔ wDSPOKPCͱͯ͑͠Δ wόοΫάϥϯυॲཧͱ͔
5BTLT wίϚϯυϥΠϯ͔ΒݺΔ wDSPOKPCͱͯ͑͠Δ wόοΫάϥϯυॲཧͱ͔ wఆظతͳॲཧͱ͔
5BTLT wίϚϯυϥΠϯ͔ΒݺΔ wDSPOKPCͱͯ͑͠Δ wόοΫάϥϯυॲཧͱ͔ wఆظతͳॲཧͱ͔ wϝϯςφϯεʹ
5BTLT wίϚϯυϥΠϯ͔ΒݺΔ wDSPOKPCͱͯ͑͠Δ wόοΫάϥϯυॲཧͱ͔ wఆظతͳॲཧͱ͔ wϝϯςφϯεʹ wϞσϧΫϥεΛίϯτϩʔϥ͔ΒݺͿ࣌Έ͍ͨʹݺΔ
͍͚Δ͔
ͬͯΈͨ
None
▾ fuel/ ▾ app/ ▸ cache/
▾ classes/ ▸ controller/ ▸ model/ ▸ twig/ ▸ view/ flickr.php ▾ config/ ▸ development/ ▸ production/ ▸ test/ config.php db.php parser.php rest.php routes.php ▸ lang/ ▸ less/ ▸ logs/ ▸ migrations/ ▸ modules/ ▾ tasks/ flickr.php robots.php ▸ tests/ ▸ tmp/ ▾ vendor/ ▸ Goutte/ ▾ phpFlickr/ auth.php example.php getToken.php phpFlickr.php README.txt ▸ Twig/ .gitkeep ֎෦ϥΠϒϥϦ
▾ fuel/ ▾ app/ ▸ cache/
▾ classes/ ▸ controller/ ▸ model/ ▸ twig/ ▸ view/ flickr.php ▾ config/ ▸ development/ ▸ production/ ▸ test/ config.php db.php parser.php rest.php routes.php ▸ lang/ ▸ less/ ▸ logs/ ▸ migrations/ ▸ modules/ ▾ tasks/ flickr.php robots.php ▸ tests/ ▸ tmp/ ▾ vendor/ ▸ Goutte/ ▾ phpFlickr/ auth.php example.php getToken.php phpFlickr.php README.txt ▸ Twig/ .gitkeep Ϋϥε
require_once APPPATH . 'vendor' . DS . 'phpFlickr' . DS
. 'phpFlickr.php'; class Flickr { protected static $_instance = null; private function __construct() { $this-‐>api = new phpFlickr( 'xxxxxxxxxxxxxxxxxxxx' //Config::get('app.flickr_api_key') ); } public static function forge() { if (empty(self::$_instance)) { static::$_instance = new static(); } return static::$_instance-‐>api; } }
▾ fuel/ ▾ app/ ▸ cache/
▾ classes/ ▸ controller/ ▸ model/ ▸ twig/ ▸ view/ flickr.php ▾ config/ ▸ development/ ▸ production/ ▸ test/ config.php db.php parser.php rest.php routes.php ▸ lang/ ▸ less/ ▸ logs/ ▸ migrations/ ▸ modules/ ▾ tasks/ flickr.php robots.php ▸ tests/ ▸ tmp/ ▾ vendor/ ▸ Goutte/ ▾ phpFlickr/ auth.php example.php getToken.php phpFlickr.php README.txt ▸ Twig/ .gitkeep λεΫ
namespace Fuel\Tasks; class Flickr { public static
function run($limit = 4) { $response = \Flickr::forge()-‐>photos_search( array( 'user_id' => '94387617@N00', 'per_page' => $limit, 'tags' => 'asgt,cover', 'tag_mode' => 'all', 'sort' => 'date-‐taken-‐desc' ) ); foreach ($response['photo'] as $photo) { $r = \Flickr::forge()-‐>photos_getInfo($photo['id']); $e = \Flickr::forge()-‐>photos_getExif($photo['id']); //print_r($e['camera']); if (null === \Model_Coverphoto::find_by('flickr_id', $r['photo']['id'])) { $r['photo']['dates']['taken']; $coverphoto = \Model_Coverphoto::forge(); $coverphoto-‐>flickr_id = $r['photo']['id']; $coverphoto-‐>title = $r['photo']['description']; $coverphoto-‐>taken_at = $r['photo']['dates']['taken']; $coverphoto-‐>camera = $e['camera']; $coverphoto-‐>data = json_encode($r['photo']); $coverphoto-‐>save(); } } } }
# crontab -‐e * * * * * cd /var/www/omoon.org;
/usr/bin/php oil refine flickr:run
None
PNPPOPSH
λά͚͚ͩͰߋ৽Մೳ
J1IPOFͷqJDLSΞϓϦͰ
ࠓޙͷల
None
None
UBTLΛੵۃతʹ͍·͠ΐ͏
͋Γ͕ͱ͏͍͟͝·ͨ͠