Frameworks da Nova Era PHP

Da8e5dfb037990a43802ef13545bf94b?s=47 Dan Jesus
November 29, 2013

Frameworks da Nova Era PHP

Palestra aprensentada na PHPConference

Da8e5dfb037990a43802ef13545bf94b?s=128

Dan Jesus

November 29, 2013
Tweet

Transcript

  1. 2.

    40#3&.*. $danjesus = [ “developer” => [“php”, js”, “ruby”, “java”,

    “objective-c”], “where” => [“LQDI Digital”, “Co-founder Solhys Tecnologia”], “blog” => [“danjesus.github.io”] ]; ! return $danjesus;
  2. 4.
  3. 6.
  4. 13.

    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
  5. 14.

    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]
  6. 19.

    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*%
  7. 20.
  8. 21.

    &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
  9. 22.

    &4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index()

    { return Response::forge(View::forge('posts/index')); } ! } 5JQPEPDPOUSPMMFS
  10. 23.

    &4536563"$0/530--&3 class Controller_Posts extends Controller { ! public function action_index()

    { return Response::forge(View::forge('posts/index')); } ! } BDUJPOQPEFSVNWFSCPIUUQDPNPHFU  QPTU QVU EFMFUF
  11. 24.

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

    $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
  13. 26.

    $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
  14. 27.

    $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
  15. 28.

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

    $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
  17. 30.

    $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
  18. 31.

    $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 )); } }
  19. 32.
  20. 33.

    namespace Model; ! class Welcome extends \Model { ! public

    static function get_results() { // Interações com o banco de dados } ! }
  21. 35.

    namespace Model; ! class User extends \Model_Crud { protected static

    $_properties = array( 'id', 'name', 'age', 'birth_date', 'gender', ); ! protected static $_table_name = 'users'; } .0%&-$36%
  22. 37.

    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.
  23. 39.
  24. 41.
  25. 42.

    $view = View::forge('path/to/view', array( 'menu' => $menu, 'articles' => $articles,

    'footer_links' => $footer_links, ))->auto_filter(); ! return $view;
  26. 48.

    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
  27. 50.

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

    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
  29. 52.
  30. 54.
  31. 55.