Your SlideShare is downloading. ×
0
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

symfony: Simplify your professional web development with PHP (Symfony PHP Quebec 2007)

21,524

Published on

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

No Downloads
Views
Total Views
21,524
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
87
Comments
0
Likes
5
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. symfony Simplify your professional web development with PHP Fabien Potencier http://www.symfony-project.com/ http://www.sensio.com/ PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 2. Sensio • French Web Agency, founded in 1998 – 150 people – 30 people dedicated to Web technologies SENSIO Web Agency Web Webmarketing Technologies Open Source Technologies (Framework PHP) PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 3. Sensio Labs • Open-Source technologies (LAMP stack) – Linux – Apache – MySQL / PostgreSQL – PHP / Perl / Python / Ruby • Open-Source dedicated team • Big company customers – Web Consulting symfony – Audit / Training PHP Framework – Web Development PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 4. symfony • PHP 5 Web Framework • Based on 9 years of Sensio experience • Based on well-known projets (Mojavi, Propel, Prado) • Open-Source Licence • Built for : MIT – Professional Websites – Complex needs Bring together – Demanding environments Entreprise World Open-Source World PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 5. Don’t reinvent the wheel • Follow best practices • MVC Pattern : Model / View / Controller • Unit and functional test framework • Environment and deployment support • Security (XSS protection by default) • Extensible (plugin system) simplify your life PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 6. Develop faster • Each line of code has a cost – To write the line less code  – To test it less complexity – To maintain it  less bugs • Write less code  – Architecture : controller, ORM, … more productivity  – Configuration more time – Autoloading – Generators – Helpers • More time for business rules, edge cases, … PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 7. Main selling points • Documentation • Configurability • XSS protection Standard • Debugging tools PHP 5 MVC • Functional tests Routing • Extensibility : Plugins Cache • Admin Generator • ORM : Propel or Doctrine • i18n / l10n • 1.0 maintained for a long time PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 8. Symfony installation • PEAR $ pear channel-discover pear.symfony-project.com $ pear install symfony/symfony-1.0.0 PEAR package Subversion easy Package • SVN / symlink Sandbox $ svn propedit svn:externals symfony http://svn.symfony-project.com/branches/1.0 recommended • Sandbox $ curl -O http://www.symfony-project.com/get/sf_sandbox-1.0.0.tgz $ tar zxpf sf_sandbox-1.0.0.tgz fast PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 9. Application Creation $ mkdir ~/sfdemo $ cd ~/sfdemo Project  $ symfony init-project sfdemo Application(s)  $ ./symfony init-app frontend Module(s)  Action(s) Composant(s)  Template PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 10. Database • Database configuration # config/databases.yml prod: Environment propel: support param: password: PAssWD all: propel: class: sfPropelDatabase param: dsn: mysql://root:@localhost/sfdemo • Schema definition SQL abstraction # config/schema.yml post: title: { type: varchar, size: 255 } content: { type: longvarchar } is_published: { type: boolean } author_id: { type: integer, foreignTable: author, foreignReference: id } created_at: ~ PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 11. Database • Test data # data/fixtures/data.yml Author: fabien: first_name: Fabien last_name: Potencier Post: 1) Creates model classes first_post: 2) Converts schema to SQL author_id: fabien 3) Creates tables title: PHP Québec 4) Loads test data $ ./symfony propel-build-all-load frontend PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 12. Model // lib/model/Author.php class Author extends BaseAuthor { function getFullName() { return $this->getFirstName().' '.$this->getLastName(); } } $author = new Author(); $author->setFirstName('Fabien'); ORM $author->setLastName('Potencier'); Object Relationship Mapping $author->save(); Propel / Doctrine $post = new Post(); $post->setAuthor($author); $post->setPublishedOn('12:00 tomorrow'); $post->isPublished(true); $post->save(); $posts = PostPeer::doSelect(new Criteria()); PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 13. Backend creation • Automatic creation of an Administration Backend, ready for production – Lists – Filters Generated code is MVC and customizable – Pagination – Validation Configuration file Controller – Tri – CRUD Templates $ ./symfony propel-init-admin frontend post Post 1) Creates a post module 2) Generates configuration PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 14. Configurability • Module level # apps/frontend/modules/post/config/generator.yml generator: class: sfPropelAdminGenerator param: Configuration model_class: Post Framework list: Project display: [=title, author, created_at] Application filters: [title, author_id, published_on] max_per_page: 5 Module • Application level # apps/frontend/config/security.yml default: is_secure: on credentials: admin LOC : 0 $ ./symfony plugin-install http://plugins.symfony-project.com/sfGuardPlugin PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 15. Admin Generator • List PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 16. Admin Generator • Edition __toString() widgets m2m relationship PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 17. Extensibility • Module extension class postActions extends autoPostActions { protected function addFiltersCriteria($c) Generated { module parent::addFiltersCriteria($c); $c->add(PostPeer::IS_PUBLISHED, true); } } • Template customization _edit_* : actions, footer, form, header, messages _list_* : footer, header, messages, td_actions, t(d|h)_stacked, t(d|h)_tabular _filters, editSuccess, listSuccess PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 18. Frontend Creation • Routing homepage: / param: { module: blog, action: recent } <?php echo url_for('@homepage') ?> url: / homepage: / param: { module: blog, action: list } url: / recent: /recent param: { module: blog, action: recent } url: /recent post: <?php echo link_to( param: { module: blog, action: show } $post->getTitle(), /blog/1.html requirements: '@post?id=’.$post->getId() id: d+ ) ?> url: /blog/:id.html PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 19. Functional Tests • Navigation simulation // test/functional/frontend/blogActionsTest.php $browser = new sfTestBrowser(); $browser->initialize(); TDD $browser-> Test Driven Development get('/blog/1.html')-> isStatusCode(200)-> checkResponseElement('h1.title', '/PHP Québec/'); $ ./symfony test-functional frontend CSS Selector # get / ok 1 - status code is 200 not ok 2 - response selector h1 does not match regex /PHP Québec/ # Looks like you failed 1 tests of 2 1..2 PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 20. Our first line of code # apps/frontend/modules/blog/actions/actions.class.php class blogActions extends sfActions { function executeShow() { $id = $this->getRequestParameter('id'); $this->post = PostPeer::retrieveByPk($id); MVC $this->forward404Unless($this->post); Model / View / Controller } XSS } shortcut Secure by default # apps/frontend/modules/post/templates/showSuccess.php <h1 class="title"><?php echo $post->getTitle() ?></h1> <h2>par <?php echo $post->getAuthor()->getFullName() ?></h2> <p><?php echo $post->getHtmlContent(ESC_RAW) ?></p> PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 21. Debugging tools • Web Debug Toolbar PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 22. Debugging tools • Error messages PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 23. Deployment $ ./symfony test-all functional/frontend/postActionsTest......................ok All tests successful. Files=1, Tests=2 # config/properties.ini [production] $ ./symfony freeze host=1.2.3.4 user=fabien dir=/var/www/sfblog type=rsync $ ./symfony sync production go PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 24. Community Plugins • New plugins are created every week – Doctrine : Full Doctrine ORM support – UJS : Unobtrusive JavaScript – PropelActAsNestedSetBehavior : Nested sets for Propel – SuperCache : HTML pages cache – ControlPanel : Web management for symfony projects – ErrorLogger : All 404 and 500 logging in a table – Guard : Authentication and authorization features – Feed2 : Web feeds management – PokaYoke : Client side validation PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 25. What’s next? • Forge : www.symfony-forge.com • New features for symfony 1.1 : – More hooks for plugins – More modularity – Doctrine support – Unobstrusive JavaScript support – New form and validation framework • Book translation , Deutsch, Español, Français Polski, Russian, , Italiano, … PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 26. A Professional Web Framework • Built from experience • 1.0 stable, maintained with commercial support • Growing community – Developpers in more than 80 countries – 100 000 visitors per month on symfony-project.com • Open-Source Documentation – The book (450 pages - GFDL) – Askeet Tutorial (250 pages) PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 27. A symfony User • Yahoo! (USA) – Yahoo! Bookmarks – 20 millions users – Web 2.0 / AJAX PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 28. Rejoignez-nous - Join Us • Sensio Labs recrute en France – Des développeurs – Des chefs de projet technique • Le Web est l’une de vos passions ? – Développeur : Vous avez une expérience dans le développement de sites Web en PHP voire en symfony. Vous développez en PHP5 objets, vous connaissez l’AJAX. – Chef de Projet : Vous êtes développeur et vous souhaitez gérer des projets pour des grands comptes. PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com
  • 29. SENSIO S.A. 26, rue Salomon de Rothschild 92 286 SURESNES cedex FRANCE Tél. : +33 1 40 99 80 80 Fax : +33 1 40 99 83 34 Contact Fabien Potencier fabien.potencier@sensio.com http://www.sensio.com/ http://www.symfony-project.com/ PHP Quebec 2007 www.symfony-project.com fabien.potencier@sensio.com www.sensio.com

×