A Pragmatic Look At Symfony The PHP 5

  • Slides: 16
Download presentation
A Pragmatic Look At Symfony (The PHP 5 framework) by Darren Beale Skillswap Bristol

A Pragmatic Look At Symfony (The PHP 5 framework) by Darren Beale Skillswap Bristol - 26 th July 2007

Who am I? Front-end & PHP Developer since 1998 Owner/Manager of Siftware Ltd in

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 4 years as owner/manager of Exponetic Ltd in Bethnal Green Front-end (inc Flash), PHP, Coldfusion and 1 year as *nix sysadmin 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 don’t post as much as I used to This is my first meeting, hello! A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

What about you? …wave them like you just don’t care How many of you

What about you? …wave them like you just don’t care How many of you are techies? How many do mostly PHP dev? Do any of you use frameworks? Symfony? A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

What’s I’ll be covering Why use a framework? Intro to Symfony’s MVC implementation Coding

What’s I’ll be covering Why use a framework? Intro to Symfony’s MVC implementation Coding a simple web application from scratch Areas for Improvement Summary What next? A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Why use a framework? Factors out common patterns Code layout Config URL routing Authentication

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 A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Intro to Symfony symfony-project. com Written in PHP 5 Superb documentation including a couple

Intro to Symfony symfony-project. com Written in PHP 5 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 A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Intro to Symfony cont… Recommended configuration Apache with mod_rewrite PHP 5. 2. x Simple

Intro to Symfony cont… Recommended configuration Apache with mod_rewrite PHP 5. 2. x Simple to install Pear #> pear channel-discover pear. symfonyproject. com #> pear install symfony/symfony Apache, Alias add alias in your Virtual. Host, e. g. /sf /usr/share/php/data/symfony/web/sf A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Intro to Symfony cont… Minimal dependencies, all included Creole Propel Library for easy command

Intro to Symfony cont… Minimal dependencies, all included Creole Propel Library for easy command line tasks LIME Object Relationship Mapping About to officially support Doctrine too but can already use via plugin PAKE Database Abstraction Support for My. SQL, Postgre. SQL, SQLite, MSSQL Library for easy unit and functional testing Plus… Prototype Script. aculo. us Tiny. MCE (WYSIWYG) Dyn. Arch. com Rich Calendar A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Symfony’s MVC implementation Model Data access and manipulation Based on Propel (by default) Built

Symfony’s 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! #> symfony propel-build-model Symfony provides classes ready for you to extend your model A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Symfony’s MVC implementation cont… View Presentation layer Global layout and configuration Each action can

Symfony’s 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 Partials and Slots There’s a Smarty plugin Template fragments without business logic Components Template fragments with business logic A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Symfony’s MVC implementation cont… Controller Routes the business logic Each ‘module’ has a controller

Symfony’s 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 A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Lots of coding Lets get our hands dirty Dev environment is Windows XP (sorry)

Lots of coding Lets get our hands dirty Dev environment is Windows XP (sorry) with Debian server running under VMWare with Apache, PHP, My. SQL and Samba Apache document root is a Samba share mapped as a drive The app I’m going to build is very simple. I had bigger plans but I de-scoped as I went along A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Summary We talked about Why frameworks are A Good Thing Intro to Symfony’s MVC

Summary We talked about Why frameworks are A Good Thing Intro to Symfony’s MVC implementation Coding a simple web application from scratch Areas for Improvement A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

Areas for Improvement I think Symfony is superb and has got a huge amount

Areas for Improvement I think Symfony is superb and has got a huge amount going for it That said, there a few area that niggle me Some of the build process is a bit flakey Seems a bit magic sometimes Well it is for me anyway Especially around refactoring But one could argue that’s the point Forums and mailing lists are not always particularly helpful They seem to be more helpful when you know what you’re 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 A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

What next? For more information Symfony-project. com Try the sample application there or Askeet!

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@siftware. co. uk I’ll put these slides up on http: //bealers. com along with the code A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)

<powerpoint /> A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol

<powerpoint /> A Pragmatic Look At Symfony (The PHP 5 framework) for Skillswap Bristol by Darren Beale (mail@bealers. com)