Your SlideShare is downloading. ×
  • Like
Simplify your professional web development with symfony
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Simplify your professional web development with symfony

  • 10,774 views
Published

Learn how symfony can make your life simple, especially if you want to develop web applications in a professional way. Warning! Contains PHP code...

Learn how symfony can make your life simple, especially if you want to develop web applications in a professional way. Warning! Contains PHP code...

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Les français peuvent voire de bon articles pour les aider sur symfony à l'adresse :
    http://blog.jaycreation.net/tag/symfony
    Are you sure you want to
    Your message goes here
  • some of these comments are true. But still it is very interesting for work.
    Are you sure you want to
    Your message goes here
  • good apresentation!!

    i'm studing symfony now, and i like much it..

    thank you<br /><br/>
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
10,774
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
738
Comments
3
Likes
24

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
  • I&apos;m François Zaninotto, manager at Sensio Labs, co-author of sf and main author of sf doc today’s presentation : how to simplify your professional web development with symfony why we created symfony 3 years ago. main selling points of symfony. features that makes symfony a good framework for your next project.

Transcript

  • 1. symfony Simplify your professional web development with PHP Francois Zaninotto http://www.symfony-project.com/ http://www.sensio.com/
  • 2. Professional
  • 3. Professional
    • Heavyweight, complex
    • Very expensive
    • Full Featured
    • Performant
    • Extensible
    • Documented
    • Supported
    • Configurable
    • Stable
    • Easy to use
    • Java Struts
    • Microsoft .Net
    • Symfony
  • 4. PHP for professionals
    • Stable
    • Performant
    • Documentation
    • Object-oriented (as of PHP5)
    • Cheap and efficient Hosts
    • Support
    • Libraries
    • Developers for hire
    • Easy
    • Cheap
    • Large Community
  • 5. PHP for professionals
    • Stable
    • Performant
    • Documentation
    • Object-oriented (as of PHP5)
    • Cheap and efficient Hosts
    • Support
    • Libraries
    • Developers for hire
    • Easy
    • Cheap
    • Large Community
    Bad reputation Spaghetti code Amateur coding Reinventing the wheel BC breaks Inconsistent syntax Bloated … PHP4
  • 6. Develop faster
    • Each line of code has a cost
      • To write the line
      • To test it
      • To maintain it
    • Write less code
      • Architecture : contr o ller, ORM, …
      • Configuration
      • Autoloading
      • Generators
      • Helpers
    • More time for business rules, edge cases, …
    less code  less complexity  less bugs  more productivity  more time
  • 7. Don’t reinvent the wheel
    • Follow best practices
    • Object orientation
    • MVC Pattern : Model / View / Contr oller
    • Object-Relational Mapping / Active Record
    • Unit and functional tests
    • Agile development
    simplify your life
  • 8. Professionals need more than PHP alone
    • a PHP framework?
  • 9. Professionals need more than PHP alone
    • a PHP framework?
  • 10. Many of them lack…
    • Tests
    • Stability
    • Support
    • Security
    • Examples
    • Liberal license
    • Documentation
    • Critical user mass
    • Multi-platformness
    • DB engines support
    • Not suitable for professionals
  • 11. Sensio
    • French Web Agency
    • Founded 9 years ago
    • 200 web projects
    • 30 people
    • Faith in open-source
    • Demanding clients
    • Objectives: Have fun
            • Make money
    Webmarketing Open Source Technologies (Framework PHP) Web Technologies SENSIO Web Agency
  • 12. The challenge
    • Bring together
    • the Enterprise world
    • and the Open-Source world
  • 13. symfony
    • PHP 5 Web Framework
    • Based on 9 years of Sensio experience
    • Based on well-known projets (Mojavi, Propel, Prado)
    • Open-Source
    • Built for :
      • Professional Websites
      • Complex needs
      • Demanding environments
    Licence MIT Bring together Entreprise World Open-Source World
  • 14. What makes the difference
    • Documentation
    • Configurability
    • XSS protection
    • Debugging tools
    • Functional tests
    • Extensibility : Plugins
    • Admin Generator
    • ORM : Propel or Doctrine
    • i18n / l10n
    • 1.0 maintained for a long time
    Standard PHP 5 MVC Routing Cache
  • 15. Installation is a breeze
    • PEAR
    • $ pear channel-discover pear.symfony-project.com
    • $ pear install symfony/symfony-1.0.0
    • SVN / symlink
    • $ svn propedit svn:externals
    • symfony http://svn.symfony-project.com/branches/1.0
    • Sandbox
    • $ curl -O http://www.symfony-project.com/get/sf_sandbox-1.0.0.tgz
    • $ tar zxpf sf_sandbox-1.0.0.tgz
    easy fast recommended
  • 16. Directory structure generation
    • $ mkdir ~/sfdemo
    • $ cd ~/sfdemo
    • $ symfony init-project sfdemo
    • $ ./symfony init-app frontend
    Project  Application(s)  Module(s)  Action(s) Composant(s)  Template
  • 17.  
  • 18. Database connection settings
    • # config/databases.yml
    • prod :
    • propel:
    • param:
    • password: PAssWD
    • all :
    • propel:
    • class: sfPropelDatabase
    • param:
    • dsn: mysql://root:@localhost/sfdemo
    Environment support
  • 19. Database schema definition
    • # 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: ~
    SQL abstraction
  • 20. Test data
    • # data/fixtures/data.yml
    • Author:
    • fabien :
    • first_name: Fabien
    • last_name: Potencier
    • Post:
    • first_post:
    • author_id: fabien
    • title: Xtech 2007
  • 21. Generate the thing
    • $ ./symfony propel-build-all-load frontend
    1) Creates model classes 2) Converts schema to SQL 3) Creates tables 4) Loads test data
  • 22. Model
    • // lib/model/Author.php
    • class Author extends BaseAuthor
    • {
    • function getFullName()
    • {
    • return $this -> getFirstName(). ' ' .$this -> getLastName();
    • }
    • }
    • $author = new Author();
    • $author -> setFirstName( 'Fabien' );
    • $author -> setLastName( 'Potencier' );
    • $author -> save();
    • $post = new Post();
    • $post -> setAuthor($author);
    • $post -> setPublishedOn( '12:00 tomorrow' );
    • $post -> isPublished( true );
    • $post -> save();
    • $posts = PostPeer :: doSelect(new Criteria());
    ORM Object Relationship Mapping Propel / Doctrine
  • 23. Backend creation
    • Automatic creation of an Administration Backend, ready for production
      • Lists
      • Pagination
      • Sorting
    • $ ./symfony propel-init-admin frontend post Post
      • Filters
      • Validation
      • CRUD
    1) Creates a post module 2) Generates configuration Generated code is MVC and customizable Configuration file Contr oller Templates
  • 24. Configurability
    • Module level
    • # apps/frontend/modules/post/config/generator.yml
    • generator:
    • class: sfPropelAdminGenerator
    • param:
    • model_class: Post
    • list :
    • display: [ =title , author, created_at]
    • filters : [title, author_id, published_on]
    • max_per_page: 5
    • Application level
    • # apps/frontend/config/security.yml
    • default:
    • is_secure: on
    • credentials: admin
    • $ ./symfony plugin-install http://plugins.symfony-project.com/ sfGuardPlugin
    Configuration Framework Project Application Module LOC : 0
  • 25. Admin Generator – list view
  • 26. Admin Generator – edit view __toString() widgets m2m relationship
  • 27. Extensibility
    • Module extension
    • class postActions extends autoPostActions
    • {
    • protected function addFiltersCriteria($c)
    • {
    • parent :: addFiltersCriteria($c);
    • $c -> add(PostPeer :: IS_PUBLISHED, true );
    • }
    • }
    • Template customization
    Generated module _edit_* : actions, footer, form, header, messages _list_* : footer, header, messages, td_actions, t(d|h)_stacked, t(d|h)_tabular _filters, editSuccess, listSuccess
  • 28. Frontend Creation
    • Routing
    <?php echo link_to( $post -> getTitle(), '@post?id=’ .$post -> getId() ) ?> post : param: { module: blog, action: show } requirements: id: d+ url: /blog/:id.html <?php echo url_for( '@homepage' ) ?> homepage : param: { module: blog, action: recent } url: / homepage : param: { module: blog, action: list } url: / recent : param: { module: blog, action: recent } url: /recent /blog/1.html / / /recent
  • 29. Functional Tests
    • Simulate navigation and make smart assertions
    • // test/functional/frontend/blogActionsTest.php
    • $browser = new sfTestBrowser();
    • $browser -> initialize();
    • $browser ->
    • get( '/blog/1.html' ) ->
    • isStatusCode( 200 ) ->
    • checkResponseElement( 'h1.title' , '/XTech 2007/' );
      • $ ./symfony test-functional frontend
      • # get /
      • ok 1 - status code is 200
      • not ok 2 - response selector h1 does not match regex /XTech 2007/
      • # Looks like you failed 1 tests of 2
      • 1..2
    TDD Test Driven Development CSS Selector
  • 30. 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);
    • $this -> forward404Unless($this -> post);
    • }
    • }
    • # apps/frontend/modules/post/templates/showSuccess.php
    • <h1 class= &quot;title&quot; ><?php echo $post -> getTitle() ?></h1>
    • <h2>par <?php echo $post -> getAuthor() -> getFullName() ?></h2>
    • <p><?php echo $post -> getHtmlContent(ESC_RAW) ?></p>
    MVC Model / View / Contr oller XSS Secure by default shortcut
  • 31. Debugging tools – The web debug toolbar
  • 32. Debugging tools – Meaningful error messages
  • 33. Deployment
    • $ ./symfony test-all
    • functional/frontend/postActionsTest...................... ok
    • All tests successful.
    • Files=1, Tests=2
    • # config/properties.ini
    • [production]
    • host= 1.2.3.4
    • user= fabien
    • dir= /var/www/sfblog
    • type= rsync
    • $ ./symfony sync production go
    $ ./symfony freeze
  • 34. Once it is in production
    • Optimized for speed and stability
    • Internals never shown
    • Logs rotation
    • Data dumping
    • 404/500 error logging
    • Incremental updates (via rsync)
  • 35. Community Plugins
    • Hooks in the symfony code allow for easy extension
    • New plugins are created every week
      • Doctrine : Full Doctrine ORM support
      • UJS : Unobtrusive JavaScript
      • PropelActAsNestedSetBehavior : Nested sets for Propel
      • PropelActAsTaggableBehavior : Easy tags 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 (read&write)
      • PokaYoke : Client side validation
  • 36. A Professional Web Framework
    • Built from experience
    • Clean, modular and customizable code
    • 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)
  • 37. Do you need a second opinion?
    • Yahoo! (USA)
    • Yahoo! Bookmarks
    • 20 millions users
    • Web 2.0 / AJAX
  • 38. What’s next?
    • Forge : www.symfony-forge.com
    • New features for symfony 1.1
      • More hooks for plugins
      • More modularity
      • Official Doctrine support
      • Unobstrusive JavaScript support
      • New form and validation framework
    • Book translation
    中文 , Deutsch, Español, Français Polski, Russian, 日本語 , Italiano, …
  • 39. How to make money with open-source?
    • Sensio Labs provides symfony-focused services
      • Training
      • Code auditing
      • Consulting
      • Web development
    • If you are looking for a job in France, we're hiring
  • 40.
    • 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
    • Francois Zaninotto
    • http://www.sensio.com/ http://www.symfony-project.com/