A Pragmatic Look At Symfony The PHP5 framework by Darren Beale PowerPoint PPT Presentation

presentation player overlay
1 / 16
About This Presentation
Transcript and Presenter's Notes

Title: A Pragmatic Look At Symfony The PHP5 framework by Darren Beale


1
A Pragmatic Look At Symfony(The PHP5
framework)by Darren Beale
  • Skillswap Bristol - 26th July 2007

2
Who am I?
  • Front-end PHP Developer since 1998
  • Owner/Manager of Siftware Ltd in
    Upton-upon-Severn
  • Siftware is 1 yr old provides outsourced web
    dev services to design and development agencies
  • The business thing is starting to interest me
    more than the tech
  • Previous to Siftware I spent 8 years in London
  • 4 years as contractor/employee
  • Front-end (inc Flash), PHP, Coldfusion and 1 year
    as nix sysadmin
  • 4 years as owner/manager of Exponetic Ltd in
    Bethnal Green
  • Grew it up to 8 staff then exited
  • It is still going strong
  • Underscore member all that time, although
  • I left Bristol within months of subscribing
  • I dont post as much as I used to
  • This is my first meeting, hello!

3
What about you?
  • wave them like you just dont care
  • How many of you are techies?
  • How many do mostly PHP dev?
  • Do any of you use frameworks?
  • Symfony?

4
Whats Ill be covering
  • Why use a framework?
  • Intro to Symfony
  • Symfonys MVC implementation
  • Coding a simple web application from scratch
  • Areas for Improvement
  • Summary
  • What next?

5
Why use a framework?
  • Factors out common patterns
  • Code layout
  • Config
  • URL routing
  • Authentication and Security
  • Form validation
  • Internationalisation/Localisation
  • Encourages good design and allows one to easily
    utilise best practices

6
Intro to Symfony
  • symfony-project.com
  • Written in PHP5
  • Superb documentation
  • including a couple of sample applications
  • The book is open source and available online
  • Forums, wiki, mailing list as one would expect
  • Lots of plugins including
  • CMS
  • Forum
  • Blog

7
Intro to Symfony cont
  • Recommended configuration
  • Apache with mod_rewrite
  • PHP5.2.x
  • Simple to install
  • Pear
  • gt pear channel-discover pear.symfony-project.com
  • gt pear install symfony/symfony
  • Apache, add alias in your VirtualHost, e.g.
  • Alias /sf /usr/share/php/data/symfony/web/sf

8
Intro to Symfony cont
  • Minimal dependencies, all included
  • Creole
  • Database Abstraction
  • Support for MySQL, PostgreSQL, SQLite, MSSQL
  • Propel
  • Object Relationship Mapping
  • About to officially support Doctrine too but can
    already use via plugin
  • PAKE
  • Library for easy command line tasks
  • LIME
  • Library for easy unit and functional testing
  • Plus
  • Prototype
  • Script.aculo.us
  • TinyMCE (WYSIWYG)
  • DynArch.com Rich Calendar

9
Symfonys MVC implementation
  • Model
  • Data access and manipulation
  • Based on Propel (by default)
  • Built in tools for pagination, sorting and
    filters
  • Model can be configured using XML or YAML
  • Symfony builds your model for you!
  • gt symfony propel-build-model
  • Symfony provides classes ready for you to extend
    your model

10
Symfonys MVC implementation cont
  • View
  • Presentation layer
  • Global layout and configuration
  • Each action can have its own sub template
  • View config can go down as low as actions
  • Symfony uses PHP as its templating language
  • Theres a Smarty plugin
  • Partials and Slots
  • Template fragments without business logic
  • Components
  • Template fragments with business logic

11
Symfonys MVC implementation cont
  • Controller
  • Routes the business logic
  • Each module has a controller class with a
    number of action methods
  • Automatic conversion of the URL into the
    appropriate module/action
  • Pre and post execute methods

12
Lots of coding
  • Lets get our hands dirty
  • Dev environment is Windows XP (sorry) with Debian
    server running under VMWare with Apache, PHP,
    MySQL and Samba
  • Apache document root is a Samba share mapped as a
    drive
  • The app Im going to build is very simple. I had
    bigger plans but I de-scoped as I went along

13
Summary
  • We talked about
  • Why frameworks are A Good Thing
  • Intro to Symfony
  • Symfonys MVC implementation
  • Coding a simple web application from scratch
  • Areas for Improvement

14
Areas for Improvement
  • I think Symfony is superb and has got a huge
    amount going for it
  • That said, there are a few area that niggle me
  • Some of the build process is a bit flakey
  • Well it is for me anyway
  • Especially around refactoring
  • Seems a bit magic sometimes
  • But one could argue thats the point
  • Forums and mailing lists are not always
    particularly helpful
  • They seem to be more helpful when you know what
    youre talking about (e.g. the documentation is
    already superb, go read that)
  • Some would argue this as a positive as it leaves
    the mailing lists free of noise

15
What next?
  • For more information
  • Symfony-project.com
  • Try the sample application there or Askeet! the
    24 day sample project
  • Feel free to email me with questions
  • darren.beale_at_siftware.co.uk
  • Ill put these slides up on http//bealers.com
    along with the code

16
  • ltpowerpoint /gt
Write a Comment
User Comments (0)
About PowerShow.com