Slide 1

Slide 1 text

FRAMEWORKS DA NOVA ERA PHP DAN JESUS

Slide 2

Slide 2 text

40#3&.*. $danjesus = [ “developer” => [“php”, js”, “ruby”, “java”, “objective-c”], “where” => [“LQDI Digital”, “Co-founder Solhys Tecnologia”], “blog” => [“danjesus.github.io”] ]; ! return $danjesus;

Slide 3

Slide 3 text

'6&-1)1 'VFM1)1JTBTJNQMF qFYJCMF DPNNVOJUZESJWFO 1)1 GSBNFXPSL CBTFEPOUIFCFTUJEFBTPG PUIFSGSBNFXPSLT XJUIBGSFTITUBSU

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

'6&-1)1 .0%6-"3 #005453"14*.1-&4 &95&/4°7&-

Slide 6

Slide 6 text

).7$

Slide 7

Slide 7 text

*/45"-"ª§0

Slide 8

Slide 8 text

DVSMHFUGVFMQIQDPNPJMcTI via curl

Slide 9

Slide 9 text

HJUDMPOFHJUHJUIVCDPNGVFMGVFMHJU via git

Slide 10

Slide 10 text

0*-$0.."/%-*/&

Slide 11

Slide 11 text

PJMDSFBUF DFMM DPOTPMF HFOFSBUF QBDLBHF SFpOF IFMQ TFSWFS UFTU 

Slide 12

Slide 12 text

PJMDSFBUF\BQQOBNF^ criando o app usando oil *OTUBMBBT EFQFOEÊODJBT DPNDPNQPTFS $MPOBP SFQPTJUÓSJPHJU &YFDVUBPT TVCNÓEVMPT

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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]

Slide 15

Slide 15 text

&4536563"'6&- $PNQPTFS %PDVNFOUBÇÄP 4VBBQQ 'VFM$PSF "TTFUTDTTKTJNH 1BDPUFTEP'VFM"VUIc0SN 

Slide 16

Slide 16 text

&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

Slide 17

Slide 17 text

$0/530--&3

Slide 18

Slide 18 text

$0/530--&3#"4& 3&45         ):#3*% 5&.1-"5&

Slide 19

Slide 19 text

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*%

Slide 20

Slide 20 text

&4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index() { return Response::forge(View::forge('posts/index')); } ! }

Slide 21

Slide 21 text

&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

Slide 22

Slide 22 text

&4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index() { return Response::forge(View::forge('posts/index')); } ! } 5JQPEPDPOUSPMMFS

Slide 23

Slide 23 text

&4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index() { return Response::forge(View::forge('posts/index')); } ! } BDUJPOQPEFSVNWFSCPIUUQDPNPHFU  QPTU QVU EFMFUF

Slide 24

Slide 24 text

$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'); } }

Slide 25

Slide 25 text

$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

Slide 26

Slide 26 text

$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

Slide 27

Slide 27 text

$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

Slide 28

Slide 28 text

$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 )); } }

Slide 29

Slide 29 text

$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

Slide 30

Slide 30 text

$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

Slide 31

Slide 31 text

$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 )); } }

Slide 32

Slide 32 text

.0%&-

Slide 33

Slide 33 text

namespace Model; ! class Welcome extends \Model { ! public static function get_results() { // Interações com o banco de dados } ! }

Slide 34

Slide 34 text

03. .0%&-$36% %#26&3:

Slide 35

Slide 35 text

namespace Model; ! class User extends \Model_Crud { protected static $_properties = array( 'id', 'name', 'age', 'birth_date', 'gender', ); ! protected static $_table_name = 'users'; } .0%&-$36%

Slide 36

Slide 36 text

User::find_all(); ! User::find(); ! User::forge(array( 'name' => 'teste', 'age' => 'teste' ... )); .0%&-$36%

Slide 37

Slide 37 text

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.

Slide 38

Slide 38 text

03. $user = new User(); $user->name = 'Dan Jesus'; $user->save(); ! $users = User::find('all');

Slide 39

Slide 39 text

7*&8

Slide 40

Slide 40 text

.645"$)& 58*( +"%& )".- 4."35: 1"34&3

Slide 41

Slide 41 text

'always_load' => array( 'packages' => array( 'parser', ), ) arquivo config.php )BCJMJUBOEPQBDLBHFQBSTFS

Slide 42

Slide 42 text

$view = View::forge('path/to/view', array( 'menu' => $menu, 'articles' => $articles, 'footer_links' => $footer_links, ))->auto_filter(); ! return $view;

Slide 43

Slide 43 text

1"35*"-4 echo render('path/to/view', array( 'menu' => $menu, 'articles' => $articles, 'footer_links' => $footer_links, ));

Slide 44

Slide 44 text

$0/'*(63"ª¸&4

Slide 45

Slide 45 text

%&7&-01.&/5 130%6$5*0/ 45"(*/( 5&45

Slide 46

Slide 46 text

'profiling' => true arquivo config.php )BCJMJUBSQIQRVJDLQSPpMMFS

Slide 47

Slide 47 text

arquivo config.php 'controller_prefix' => 'Controller\\' 6TBSOBNFTQBDFOPTDPOUSPMMFST

Slide 48

Slide 48 text

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

Slide 49

Slide 49 text

arquivo config.php )BCJMJUBOEP1BDLBHFT 'always_load' => array( 'packages' => array( 'orm', ), )

Slide 50

Slide 50 text

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'), );

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

'6&-$03&

Slide 53

Slide 53 text

1SPKFUPOP(JUIVCIUUQTHJUIVCDPNGVFMQIQ $POUSJCVJOEPDPN'VFM1)1IUUQTHJUIVCDPNGVFMGVFMXJLJ$POUSJCVUJOH 'VFM1)1JTTVFUSBDLFSIUUQGVFMQIQDPNDPOUSJCVUFJTTVFUSBDLFS 'VFM1)1IUUQGVFMQIQDPNCMPHTBOVQEBUF 3&'&3­/$*"4

Slide 54

Slide 54 text

1&3(6/5"4

Slide 55

Slide 55 text

0#3*("%0