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
Frameworks da Nova Era PHP
Search
Dan Jesus
November 29, 2013
Programming
1
100
Frameworks da Nova Era PHP
Palestra aprensentada na PHPConference
Dan Jesus
November 29, 2013
Tweet
Share
More Decks by Dan Jesus
See All by Dan Jesus
Turbinando seu Ambiente com Yeoman - TDC SP 2013
danjesus
0
260
Ferramentas e Produtividade em JS
danjesus
3
150
Turbinando seu ambiente de desenvolvimento com Yeoman
danjesus
3
220
Porque criar seu próprio framework PHP
danjesus
3
590
Other Decks in Programming
See All in Programming
研究開発と実装OSSと プロダクトの好循環 / A virtuous cycle of research and development implementation OSS and products
linyows
1
180
Windows版PHPのビルド手順とPHP 8.4における変更点
matsuo_atsushi
0
360
JavaOne 2025: Advancing Java Profiling
jbachorik
1
300
remix + cloudflare workers (DO) docker上でいい感じに開発する
yoshidatomoaki
0
110
SideKiqでジョブが二重起動した事象を深堀りしました
t_hatachi
0
180
複数ドメインに散らばってしまった画像…! 運用中のPHPアプリに後からCDNを導入する…!
suguruooki
0
410
安全に倒し切るリリースをするために:15年来レガシーシステムのフルリプレイス挑戦記
sakuraikotone
5
2.1k
Identifying and Analyzing Fake OSS with Malware - fukuoka.go#21
rhykw
0
530
本当だってば!俺もTRICK 2022に入賞してたんだってば!
jinroq
0
190
AIエージェントを活用したアプリ開発手法の模索
kumamotone
1
730
‘무차별 LGTM~👍’만 외치던 우리가 ‘고봉밥 코드 리뷰’를?
hannah0731
0
510
「その気にさせる」エンジニアが 最強のリーダーになる理由
gimupop
3
470
Featured
See All Featured
Gamification - CAS2011
davidbonilla
80
5.2k
Fireside Chat
paigeccino
37
3.3k
Making Projects Easy
brettharned
116
6.1k
Typedesign – Prime Four
hannesfritz
41
2.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.4k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
How STYLIGHT went responsive
nonsquared
99
5.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.5k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
4
460
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
A Philosophy of Restraint
colly
203
16k
Transcript
FRAMEWORKS DA NOVA ERA PHP DAN JESUS
40#3&.*. $danjesus = [ “developer” => [“php”, js”, “ruby”, “java”,
“objective-c”], “where” => [“LQDI Digital”, “Co-founder Solhys Tecnologia”], “blog” => [“danjesus.github.io”] ]; ! return $danjesus;
'6&-1)1 'VFM1)1JTBTJNQMF qFYJCMF DPNNVOJUZESJWFO 1)1 GSBNFXPSL CBTFEPOUIFCFTUJEFBTPG PUIFSGSBNFXPSLT XJUIBGSFTITUBSU
None
'6&-1)1 .0%6-"3 #005453"14*.1-&4 &95&/4°7&-
).7$
*/45"-"ª§0
DVSMHFUGVFMQIQDPNPJMcTI via curl
HJUDMPOFHJUHJUIVCDPNGVFMGVFMHJU via git
0*-$0.."/%-*/&
PJMDSFBUF DFMM DPOTPMF HFOFSBUF QBDLBHF SFpOF IFMQ TFSWFS UFTU
PJMDSFBUF\BQQOBNF^ criando o app usando oil *OTUBMBBT EFQFOEÊODJBT DPNDPNQPTFS $MPOBP
SFQPTJUÓSJPHJU &YFDVUBPT TVCNÓEVMPT
criando um controller PJMHFOFSBUF DPOUSPMMFS\BDUJPOT^ oil generate controller Posts index
view add criando um model PJMHFOFSBUF NPEFM oil generate controller Post index view add
scaffolding criando automaticamente PJMHFOFSBUF TDB⒎PME oil generate scaffold Post title:varchar[200]
content:text migrations PJMHFOFSBUFNJHSBUJPO\OBNF^ oil generate migration add_image_to_post image:varchar[200]
&4536563"'6&- $PNQPTFS %PDVNFOUBÇÄP 4VBBQQ 'VFM$PSF "TTFUTDTTKTJNH 1BDPUFTEP'VFM"VUIc0SN
&4536563""11 "SRVJWPEFJOJDJBMJ[BÇÄPEBBQQ $BDIF $POUSPMMFST .PEFMT .PEFM7JFX $POpHVSBÇÕFT *OJOUFSOBDJPOBMJ[BÇÄP "SRVJWPTEFMPH .JHSBUJPOT
.ÓEVMPT 5BSFGBT 5FTUFT "SRVJWPTUFNQPSÂSJPT -JCTEFUFSDFJSPT 7JFXTIUNM NVTUBDIF UXJH
$0/530--&3
$0/530--&3#"4& 3&45
):#3*% 5&.1-"5&
class Controller_Posts extends Controller {} class Controller_Posts extends Controller_Template {}
class Controller_Posts extends Controller_Rest {} class Controller_Posts extends Controller_Hybrid {} #"4& 5&.1-"5& 3&45 ):#3*%
&4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index()
{ return Response::forge(View::forge('posts/index')); } ! }
&4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index()
{ return Response::forge(View::forge('posts/index')); } ! } 1SFpYP$POUSPMMFS@QPEFTFSBMUFSBEPOBT DPOpHVSBÇÕFTQBSBVTBSVNOBNFTQBDF
&4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index()
{ return Response::forge(View::forge('posts/index')); } ! } 5JQPEPDPOUSPMMFS
&4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index()
{ return Response::forge(View::forge('posts/index')); } ! } BDUJPOQPEFSVNWFSCPIUUQDPNPHFU QPTU QVU EFMFUF
$0/530--&35&.1-"5& class Controller_Posts extends Controller_Template { //default template.php $this->template =
'template-name'; ! public function action_index() { $this->template->title = 'Template Controller'; $this->template->content = View::forge('posts/index'); } }
$0/530--&35&.1-"5& class Controller_Posts extends Controller_Template { //default template.php $this->template =
'template-name'; ! public function action_index() { $this->template->title = 'Template Controller'; $this->template->content = View::forge('posts/index'); } } 1FSNJUFBQBTTBHFNEFWBSJÂWFJTFWJFXT QBSBPUFNQMBUF
$0/530--&35&.1-"5& class Controller_Posts extends Controller_Template { //default template.php $this->template =
'template-name'; ! public function action_index() { $this->template->title = 'Template Controller'; $this->template->content = View::forge('posts/index'); } } 7JFXRVFTFSÂSFOEFSJ[BEBEFOUSPEFTUB ÂSFBOPUFNQMBUF
$0/530--&35&.1-"5& class Controller_Posts extends Controller_Template { //default template.php $this->template =
'template-name'; ! public function action_index() { $this->template->title = 'Template Controller'; $this->template->content = View::forge('posts/index'); } } 7JFXRVFTFSÂSFOEFSJ[BEBEFOUSPEFTUB ÂSFBOPUFNQMBUF
$0/530--&33&45 class Controller_Test extends Controller_Rest { protected $format = 'json';
! public function get_list() { return $this->response(array( 'foo' => Input::get('foo'), 'baz' => array( 1, 50, 219 ), 'empty' => null )); } }
$0/530--&33&45 class Controller_Test extends Controller_Rest { protected $format = 'json';
! public function get_list() { return $this->response(array( 'foo' => Input::get('foo'), 'baz' => array( 1, 50, 219 ), 'empty' => null )); } } 'PSNBUPQPEFTFSKTPO YNM DTW IUNM QIQ PVTFSJBMJ[F
$0/530--&33&45 class Controller_Test extends Controller_Rest { protected $format = 'json';
! public function get_list() { return $this->response(array( 'foo' => Input::get('foo'), 'baz' => array( 1, 50, 219 ), 'empty' => null )); } } BDUJPOQPEFTFSHFU QPTU QVU EFMFUFPV QBUDI
$0/530--&3):#3*% class Controller_Post extends Controller_Hybrid { protected $format = 'json';
! public function action_index() { $this->template->content = View::forge('posts/index'); } ! public function get_list() { return $this->response(array( 'foo' => Input::get('foo'), 'baz' => array( 1, 50, 219 ), 'empty' => null )); } }
.0%&-
namespace Model; ! class Welcome extends \Model { ! public
static function get_results() { // Interações com o banco de dados } ! }
03. .0%&-$36% %#26&3:
namespace Model; ! class User extends \Model_Crud { protected static
$_properties = array( 'id', 'name', 'age', 'birth_date', 'gender', ); ! protected static $_table_name = 'users'; } .0%&-$36%
User::find_all(); ! User::find(); ! User::forge(array( 'name' => 'teste', 'age' =>
'teste' ... )); .0%&-$36%
namespace Model; ! use Orm\Model; ! class User extends Model
{ protected static $_properties = array( 'id', 'name', ); ! protected static $_table_name = 'users'; ! protected $_observers; protected $_belongs_to; protected $_has_many; protected $_has_one; protected $_many_many; } 03.
03. $user = new User(); $user->name = 'Dan Jesus'; $user->save();
! $users = User::find('all');
7*&8
.645"$)& 58*( +"%& )".- 4."35: 1"34&3
'always_load' => array( 'packages' => array( 'parser', ), ) arquivo
config.php )BCJMJUBOEPQBDLBHFQBSTFS
$view = View::forge('path/to/view', array( 'menu' => $menu, 'articles' => $articles,
'footer_links' => $footer_links, ))->auto_filter(); ! return $view;
1"35*"-4 echo render('path/to/view', array( 'menu' => $menu, 'articles' => $articles,
'footer_links' => $footer_links, ));
$0/'*(63"ª¸&4
%&7&-01.&/5 130%6$5*0/ 45"(*/( 5&45
'profiling' => true arquivo config.php )BCJMJUBSQIQRVJDLQSPpMMFS
arquivo config.php 'controller_prefix' => 'Controller\\' 6TBSOBNFTQBDFOPTDPOUSPMMFST
arquivo developement/db.php return array( 'default' => array( 'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=fuel_dev', 'username' => 'root', 'password' => 'root', ), ! 'profilling' => true ), ); $POpHVSBÇÄPEPCBODPEFEBEPT
arquivo config.php )BCJMJUBOEP1BDLBHFT 'always_load' => array( 'packages' => array( 'orm',
), )
arquivo routes.php return array( '_root_' => 'welcome/index', // The default
route '_404_' => 'welcome/404', // The main 404 route 'hello(/:name)?' => array('welcome/hello', 'name' => 'hello'), );
public static function validate($factory) { $val = Validation::forge($factory); $val->add_field('title', 'Title',
'required|max_length[50]'); $val->add_field('content', 'Content', 'required'); ! return $val; } Validações no model
'6&-$03&
1SPKFUPOP(JUIVCIUUQTHJUIVCDPNGVFMQIQ $POUSJCVJOEPDPN'VFM1)1IUUQTHJUIVCDPNGVFMGVFMXJLJ$POUSJCVUJOH 'VFM1)1JTTVFUSBDLFSIUUQGVFMQIQDPNDPOUSJCVUFJTTVFUSBDLFS 'VFM1)1IUUQGVFMQIQDPNCMPHTBOVQEBUF 3&'&3/$*"4
1&3(6/5"4
0#3*("%0