LoneStarPHP Symfony2, Its Play Time

2,313 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,313
On SlideShare
0
From Embeds
0
Number of Embeds
17
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • A good time to try symfony2 as it nears its final release. It is currently at Beta4.There are already a lot of companies using symfony2 in one form or another, my last company used it very extensively to power both our frontend website and our backend distributed video & photo processing cluster.
  • Symfony2 is a group of standalone components bundled together to make a full service frameworkIt removes the box..
  • Symfony2 is a group of standalone components bundled together to make a full service frameworkIt removes the box..
  • Zend_Application reduced the barrier of entry
  • Zend_Application reduced the barrier of entry
  • Zend_Application reduced the barrier of entry
  • Symfony2 speak, a bundle is a structured set of files (PHP files, stylesheets, JavaScripts, images, ...) that implements a single feature (a blog, a forum, ...) and which can be easily shared with other developers
  • Bundles are reusable modules done right
  • Less MagicAutoloadingExplicit configurationDoctrine2 & Datamapping difference between active record
  • Less MagicAutoloadingExplicit configurationDoctrine2 & Datamapping difference between active record
  • Less MagicAutoloadingExplicit configurationDoctrine2 & Datamapping difference between active record
  • Less MagicAutoloadingExplicit configurationDoctrine2 & Datamapping difference between active record- Tough to unit test doctrine 1.2, a lot of magic
  • Not native to PHPAllow for less work and keep routing and templating togetherThrough SymfonyExtraBundle you can specify http cache times & require specific user rights to an action
  • LoneStarPHP Symfony2, Its Play Time

    1. 1. Symfony2: It’s Play Time<br />@geoffreytranwww.linkedin.com/in/geoffreytran<br />
    2. 2. IAMA<br />Software Engineer at RAPP<br />Working with PHP since 2005<br />Co-Founded #zftalk & #zftalk.dev<br />Dormant Zend Framework Contributor<br />Zend_Application<br />Zend_Navigation<br />Zend_Paginator<br />Zend_View_Helper_BaseUrl<br />
    3. 3. What is Symfony2?<br />It simply solves your difficult redundant problems<br />… and gets out of your way<br />
    4. 4. You are not boxed in…<br />
    5. 5. … easy to get started, yet powerful and flexible for advanced users<br />
    6. 6. Pre Zend_Application Bootstrap<br />Index.php<br />
    7. 7. Post Zend_Application<br />Index.php<br />
    8. 8. “The core architecture is now stable…”<br /> – Fabien Potencier<br />http://symfony.com/blog/symfony2-final-version-we-are-not-there-yet<br />
    9. 9. In development since December 2009<br />
    10. 10. A lot can happen in a year<br />A baby?<br />
    11. 11. THE NEXT <br />BIEBER?<br />
    12. 12. A new job?<br />
    13. 13.
    14. 14. Top 2% of projects on Ohloh<br />
    15. 15. 325 Bundles Published<br />http://symfony2bundles.org/<br />
    16. 16. What exactly is a bundle?<br />A bundle is like a plugin<br />… except Symfony2 itself is made up of bundles<br />
    17. 17. “Iwas using the same idea by organizing my code in [zend framework] modules, but this is really painful”<br />-- tawfekov via StackOverflow<br />http://stackoverflow.com/questions/5053369/do-you-think-zend-framework-misses-the-symfonys-bundle-principle<br />
    18. 18. Nothing like Symfony1<br />
    19. 19. Less Magic<br />config_autoload.yml.php<br />
    20. 20. Explicit Configuration<br />app/AppKernel.php<br />
    21. 21. Doctrine2<br />Doctrine2: User.php<br />Doctrine 1.2: User.php<br />
    22. 22. Decoupled design<br />
    23. 23.
    24. 24.
    25. 25.
    26. 26.
    27. 27. Problems Solved<br />Routing<br />Templating<br />Authentication<br />Authorization<br />Data Persistence<br />Asset Management<br />Logging<br />Testing<br />Validation<br />Forms<br />Translations<br />Dependency Injection<br />Console Tasks<br />Caching<br />
    28. 28. What makes up Symfony2?<br />
    29. 29. Getting started with Symfony2 distributions<br />Similar to Linux distributions<br />
    30. 30. http://symfony.com/download<br />
    31. 31. # cd ~/Projects/LoneStarPHP<br /># tar xvzf/path/to/Symfony_Standard_Vendors_2.0.0BETA4.tgz<br />Extract to your web directory<br />
    32. 32. Check requirements<br />Not accessing from localhost? Remove the security check from:<br />web/config.phpweb/app_dev.php<br />http://yourhost/LoneStarPHP/web/config.php<br />
    33. 33. Check requirements<br />http://yourhost/LoneStarPHP/web/config.php<br />
    34. 34. Check requirements<br />http://yourhost/LoneStarPHP/web/config.php<br />
    35. 35. Check requirements<br />http://yourhost/LoneStarPHP/web/config.php<br />
    36. 36. Check requirements<br />http://yourhost/LoneStarPHP/web/config.php<br />
    37. 37. Configure the database connection<br />You can write your own configuration files instead<br />http://yourhost/LoneStarPHP/web/app_dev.php/_configurator/step/0<br />
    38. 38. Yay, Welcome to Symfony!<br />http://yourhost/LoneStarPHP/web/app_dev.php<br />
    39. 39. What makes a page?<br />/hello/world<br />A Route<br /> /hello/{name}<br />A Controller<br /> A PHP function<br />A Response<br /> “<h1>Hello World!</h1>”<br />
    40. 40. Step 1: Create a route<br />/hello/world<br />File: app/config/routing.yml<br />AcmeDemoBundle:LoneStar:hello<br />maps to<br />AcmeDemoBundleControllerLoneStar::helloAction()<br />* Routing can also be defined with XML, PHP and as annotations<br />
    41. 41. Step 2: Create a controller<br />/hello/world<br />File: src/Acme/DemoBundle/Controller/LoneStarController.php<br />* At its simplest, a controller is just a function<br />
    42. 42. Step 2: Create a controller<br />/hello/world<br />File: app/config/routing.yml<br />File: src/Acme/DemoBundle/Controller/LoneStarController.php<br />
    43. 43. /hello/world<br />http://yourhost/LoneStarPHP/web/app_dev.php/hello/world<br />
    44. 44. Great… But HTML in controllers? &@*$%! <br />
    45. 45. Meet Twig<br />src/Acme/DemoBundle/Resources/views/LoneStar/hello.html.twig<br />src/Acme/DemoBundle/Controller/LoneStarController.php<br />http://www.twig-project.org<br />
    46. 46. Hello World!<br />http://yourhost/LoneStarPHP/web/app_dev.php/hello/world<br />
    47. 47. Digging Deeper<br />http://yourhost/LoneStarPHP/web/app_dev.php/hello/world<br />
    48. 48. Digging Deeper<br />http://yourhost/LoneStarPHP/web/app_dev.php/hello/world<br />
    49. 49. Do less work<br />/hello/world<br />File: src/Acme/DemoBundle/Controller/LoneStarController.php<br />
    50. 50. Give it a try…<br />

    ×