symfony Simplify your professional web development with PHP - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

symfony Simplify your professional web development with PHP

Description:

PHP 5 Web Framework. Based on 9 years of Sensio experience ... modules/post/templates/showSuccess.php h1 class='title' ?php echo $post- getTitle() ? /h1 ... – PowerPoint PPT presentation

Number of Views:1218
Avg rating:5.0/5.0
Slides: 30
Provided by: fabienpo
Category:

less

Transcript and Presenter's Notes

Title: symfony Simplify your professional web development with PHP


1
symfonySimplify your professionalweb
development with PHP
  • Francois Zaninotto
  • http//www.symfony-project.com/
  • http//www.sensio.com/

2
Sensio
  • French Web Agency, founded in 1998
  • 150 people
  • 30 people dedicated to Web technologies

3
Sensio Labs
  • Big company customers
  • Web Consulting
  • Audit / Training
  • Web Development
  • Open-Source technologies (LAMP stack)
  • Linux
  • Apache
  • MySQL / PostgreSQL
  • PHP / Perl / Python / Ruby
  • Open-Source dedicated team

4
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

5
Dont 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)

6
Develop faster
  • Each line of code has a cost
  • To write the line
  • To test it
  • To maintain it
  • Write less code
  • Architecture controller, ORM,
  • Configuration
  • Autoloading
  • Generators
  • Helpers
  • More time for business rules, edge cases,

7
Main selling points
  • 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

8
Symfony installation
  • PEAR
  • pear channel-discover pear.symfony-project.com
  • pear install symfony/symfony-1.0.0
  • SVN / symlink
  • svn propedit svnexternals
  • 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

9
Application Creation
  • mkdir /sfdemo
  • cd /sfdemo
  • symfony init-project sfdemo
  • ./symfony init-app frontend

10
Database
  • Database connection
  • config/databases.yml
  • prod
  • propel
  • param
  • password PAssWD
  • all
  • propel
  • class sfPropelDatabase
  • param
  • dsn mysql//root_at_localhost/sfdem
    o
  • 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

11
Database
  • Test data
  • data/fixtures/data.yml
  • Author
  • fabien
  • first_name Fabien
  • last_name Potencier
  • Post
  • first_post
  • author_id fabien
  • title Xtech 2007
  • ./symfony propel-build-all-load frontend

12
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('1200 tomorrow')
  • post-isPublished(true)
  • post-save()

13
Backend creation
  • Automatic creation of an Administration Backend,
    ready for production
  • Lists
  • Pagination
  • Sorting
  • ./symfony propel-init-admin frontend post Post
  • Filters
  • Validation
  • CRUD

14
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

15
Admin Generator
  • List

16
Admin Generator
  • Edition

17
Extensibility
  • Module extension
  • class postActions extends autoPostActions
  • protected function addFiltersCriteria(c)
  • parentaddFiltersCriteria(c)
  • c-add(PostPeerIS_PUBLISHED, true)
  • Template customization

18
Frontend Creation
  • Routing

homepage param module blog, action recent
url /

homepage param module blog, action list
url / recent param module blog,
action recent url /recent
post param module blog, action show
requirements id \d url /blog/id.html
getTitle(),
'_at_post?id.post-getId() ) ?
19
Functional Tests
  • Navigation simulation
  • // test/functional/frontend/blogActionsTest.ph
    p
  • 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

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 PostPeerretrieveByPk(id)
  • this-forward404Unless(this-post)
  • apps/frontend/modules/post/templates/showSuccess
    .php
  • getTitle()
    ?
  • par getAuthor()-getFullName
    () ?
  • getHtmlContent(ESC_RAW)
    ?

21
Debugging tools
  • Web Debug Toolbar

22
Debugging tools
  • Error messages

23
Deployment
  • ./symfony test-all
  • functional/frontend/postActionsTest...............
    .......ok
  • All tests successful.
  • Files1, Tests2
  • config/properties.ini
  • production
  • host1.2.3.4
  • userfabien
  • dir/var/www/sfblog
  • typersync
  • ./symfony sync production go

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

25
Whats 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

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)

27
symfony Users
  • Yahoo! (USA)
  • Yahoo! Bookmarks
  • 20 millions users
  • Web 2.0 / AJAX

28
Rejoignez-nous - Join Us
  • Sensio Labs recrute en France
  • Des développeurs
  • Des chefs de projet technique
  • Le Web est lune 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 lAJAX.
  • Chef de Projet Vous êtes développeur et vous
    souhaitez gérer des projets pour des grands
    comptes.

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_at_sensio.com
  • http//www.sensio.com/
    http//www.symfony-project.com/
Write a Comment
User Comments (0)
About PowerShow.com