- PeterMoulding.com
- Author
- Trainer
- Speaker
- Business Coach
- How to write a How To book
- PHP Courses
- Speaking
- Web Architect
- Australia
- Books
- Authors
- Akkana Peck
- Alex Berenson
- Andrew Nugent
- Ben Sanders
- Brock Clarke
- Chris Simms
- David Mercer
- Dianna Mullet
- Don Winslow
- Dori Smith
- Harlan Coben
- Jack McDevitt
- James Wines
- Jerry Yudelson
- John Grisham
- Kevin Mullet
- L. E. Modesitt Jr.
- Laurell K. Hamilton
- Marshall Karp
- Martina Cole
- Michael Marshall Smith
- Michel Roux Jr
- Nadia Sawalha
- Philip Pullman
- Raymond Khoury
- Richard North Patterson
- Robert Masello
- Sally Roth
- Sarah Langan
- Stella Rimington
- Stephen Booth
- Stephen King
- Stephen Leather
- T.C. Boyle
- Tom Negrino
- Tony Hillerman
- Urban Waite
- Val McDermid
- Valerio Massimo Manfredi
- Beginning GIMP
- Beginning Visual C++
- Culturalism
- Fiction
- A Drink Before The War
- A Talent for War
- Bag of Bones
- Blood and Ice
- Burn
- Dark Lady
- Dead Line
- Eclipse
- Empress of Eternity
- Exley
- Flipping Out
- Just One Look
- Nightfall
- Pet Sematary
- Savage Moon
- Skinwalkers
- Starvation Lake
- The Fallen
- The Gardens of the Dead
- The Jump
- The Last Templar
- The Mermaids Singing
- The Midnight Mayor
- The Secret Soldier
- The Summons
- The Terror of Living
- The Testament
- The Tower
- Under the Dome
- Virus
- AJAX and PHP
- Aging with Grace
- Food books
- Green Architecture
- Life Is So Good
- SQL: The Complete Reference
- The Backyard Bird Lover's Ultimate How-to Guide
- The Garden Gurus
- Authors
- Sustainability
- -18 hours left to decide the future of Australia
- Campbells vegetable stock or Massel vegetable stock?
- Carbon Sequestration
- Carbon tax for Australia is a fraud
- Copenhagen will fail
- Cost of living in Australia
- Dick Smith jumps on the population bandwagon
- Dry Run: Preventing the Next Urban Water Crisis
- Energy Saving Lights
- Garlic
- How many people can live in Australia?
- Its obsolete, throw it out!
- Julia Gillard offers 9.9 billion dollars bribe to Rob Oakeshott
- Laundry detergent
- Petrol or Diesel?
- Reflective foil batts kill
- RoHS
- Sea level to rise 3mm due to climate change
- Solar power
- Spring again in Sydney
- Sustainable fuels
- The CRUD Tax is back
- The people who make building regulations do not own houses
- Water efficiency
- Which insulation is safer, foil or wool?
- Will Australia reduce greenhouse gas emissions?
- Technology
- Android or Blackberry or iPhone or a flip phone?
- Apple versus Google 2011
- Cameras
- Cars
- Colour
- Burgundy
- Colour Blindness
- Colour Names
- Dulux colours
- Pantone colours
- Safe Colours
- Seculine ProDisk Mini colour balance card
- What Causes Colour Blindness?
- Hardware
- Batteries for the Digital Age
- Cables
- Cases
- Computer reliability
- Computrace
- Disks
- Astone ISO Gear 481E
- Best SSD for your notebook computer
- Disk block size
- Hitachi disk HDS722020ALA330
- LaCie USB 2.0 250 GB mobile hard drive design by F.A. Porsche
- SMART disk
- Samsung 2 TB HD204UI quiet low power disk for mass storage
- Seagate and Samsung merge disk business
- Select the right disk for your RAID array
- USB disk speed
- Western Digital WD20EARX 2 GB SATA 3 disk
- How long should computer hardware last?
- Keyboards
- Mainframe
- Memory cards
- Monitors
- Netbooks, notebooks, tablets, and xPads
- Network Attached Storage
- OLED Displays
- PC's are a thing of the past
- Printers
- Quiet
- Samsung Galaxy S
- Speed
- Television
- Tools
- USB
- Worst computer movies
- Xserve is dead. What next?
- Your backup will not work
- Z68 motherboards
- iPad or Acer Aspire One?
- IQ
- LG Intello Washing Machine
- Lack of a challenge
- Networks
- 802.11n wireless networking
- D-Link DIR-655 wireless router
- D-Link DWA-160 Xtreme N dual band USB adapter
- D-Link DWA-556 Xtreme N PCI Express desktop adapter
- MIMO
- NBN spends another $12 billion of our tax money on nothing
- National Broadband Network
- Netgear wireless modem router DGND3300 with 300 Mbps 802.11n
- Refrigerator kills wireless broadband
- Small Wireless Network
- TP-LINK TL-SG10005D 5 port gigabit switch
- TP-Link TL-WR1043N wireless N gigabit router
- Telstra Pre-paid Mobile Wi-Fi
- Where are the router plus proxy server combinations?
- Open Source documentation
- Software
- 7-zip
- Accounting
- Asterisk
- Audacity
- Backup software
- Bloat only in Windows
- CAD
- CDex
- Disk imaging software for copying and backup
- Exact Audio Copy
- Filezilla
- Firefox
- Java
- LibreOffice or OpenOffice?
- Linux
- 1 in 5 servers will ship with Linux
- Android phones outsell iPhone
- Another Move to Linux
- CentOS 5.5 installation on SSD and RAID 5
- Debian
- Debian 5.0.5 AMD64 installation
- Debian 5.06 installation
- Fedora
- Fedora or Ubuntu?
- Gnome or KDE?
- K9copy
- Linux 2.6.38
- Linux Gnome login settings lost
- Linux Mint
- Linux RAID, a rant
- Linux Speed
- Linux Time
- Linux reliability as demonstrated by Ubuntu 10.10
- Linux reliability as demonstrated by Ubuntu 11.4
- Linux still a struggle in 2011
- Linux workstation disk RAID 1
- Linux, NT, Windows, and SETI
- Linux, three years of progress
- London Stock Exchange switches to Linux
- Mandrake Linux 9.2
- The partition is misaligned by 48128 bytes - warning from Linux RAID
- Ubuntu
- How to fix the scroll bars in Ubuntu 11.4 Gnome
- Kubuntu 10.10 alternate installation on desktop with RAID 1
- POWbuntu
- Ubuntu 10.10 after 6 months use
- Ubuntu 10.10 alternate installation
- Ubuntu 10.10 desktop RAID 1
- Ubuntu 10.10 desktop RAID 5
- Ubuntu 10.10 desktop install on a netbook
- Ubuntu 10.10 desktop installation
- Ubuntu 10.10 netbook install on a netbook
- Ubuntu 10.10 server AMD64
- Ubuntu 10.10 upgrade to version 11.4 beta 2
- Ubuntu 10.4
- Ubuntu 11.10
- Ubuntu 11.10 first upgrade
- Ubuntu 11.4 after one month use
- Ubuntu 12.04 beta1 desktop amd64
- Ubuntu One
- Ubuntu by Microsoft?
- Ubuntu desktop upgrade 10.4 to 10.10 failed because I did not check the media
- Ubuntu strikes again
- Upgrade Ubuntu to Linux Mint 12 LDXE for extra speed
- Yes, use Linux but not that distribution!
- Nero
- OpenOffice
- OpenOffice is now Apache Office
- Project management
- Scribus
- Software for Windows and Linux
- Text editors
- Time
- Todo applications
- Tomboy notes
- Top text editors
- Version control
- VideoLAN VLC media player
- Visio
- Webmin
- Webmin installation on CentOS for Web development
- Webmin installation on Ubuntu
- What is the most popular open source software today?
- Windows
- Another Windows person goes Linux
- BAD_POOL_CALLER
- Cygwin
- Microsoft Malicious Software Removal Tool cannot find a common virus
- One of the developers of Windows XP is criminally insane
- There are unused icons on your desktop
- W32time
- Which Windows version?
- Windows 7 Home Premium
- Windows XP Stop 0x0000007B during installation
- Windows XP is a disaster
- Windows processes
- XML
- Zip, bzip, gzip, or 7zip?
- configFree
- Technology Succession Planning
- VoIP
- Web Sites
- Drupal
- Do Drupal themes have to use the GPL?
- Drupal 7
- A better search facility for Drupal
- Drupal - performance or flexibility
- Drupal 7 Fields are hard to fix
- Drupal 7 new features
- Drupal 7 ships on January 5
- Drupal 7.14
- Drupal 7.4 hits PeterMoulding.com
- Drupal function sequence
- The evolution of a module
- Undefined index: headers in DefaultMailSystem->mail() (line 54 of /modules/system/system.mail.inc).
- Undefined index: to in DefaultMailSystem->mail() (line 83 of /modules/system/system.mail.inc).
- implode(): Invalid arguments passed in DefaultMailSystem->format() (line 23 of /modules/system/system.mail.inc).
- Drupal 8
- Drupal Code Load Cut
- Drupal How To
- Drupal Modules
- Backup and Migrate
- Browscap
- CKEditor with Drupal WYSIWYG
- Captcha
- Cel
- Colorbox
- Content Construction Kit
- Content type
- Devel module for Drupal
- Drupal Rules as an automation language
- Drupal Spam add-on module
- Form alter to node
- IMCE
- IMCE Wysiwyg bridge
- ImageAPI
- Jdog
- Lightbox2
- Module variable
- Node Gallery Access
- Node_Gallery
- Path
- Path redirect
- Pathauto
- Pet
- Search
- Service links
- Session Variable
- Statistics
- Taxonomy
- Token
- Token ex
- Transliteration
- Trigger
- Watch
- Other modules
- Drupal Training
- Drupal access controls need a major rewrite
- Drupal coding tricks
- Drupal performance
- Drupal themes for the future
- Drupal.org colours
- Import existing data into Drupal
- Multiple Web sites made easy using Drupal multisite and the right start
- drupal_lookup_path()
- Adobe PDF
- Apache
- Apache Mahout
- Audi.com
- Bleet
- CSS Strikes Again
- CSS or xCSS
- Can you believe Facebook or email?
- Content Management Systems
- Databases
- Facebook scam
- Font
- Fonts
- HTML
- Install Apache, MySQL, and PHP 5 in Ubuntu 11.4 using the Ubuntu Software Centre
- Language Codes
- Marketing
- Memcache
- Nginx
- Open source development hits another roadblock
- Oscars
- PHP
- SPDY
- Search software
- Techoni.com.au
- Theme themes
- Things to hate on Web sites
- U.S. Patent No. 6,985,875
- Virtual Private Server
- Visible Improvement
- Web 4.0
- Web browser usage
- Web browsers
- Web site development
- Bluefish
- Crying over spilt code
- Eclipse and PHP
- Getting a Git client, a story of ancient technology and pain
- HTTrack
- MVC
- Netbeans
- PHP or ..., CakePHP/Symfony/ZF versus ...
- Programming
- Superfish
- Web browser emulators for testing your Web site
- Web development frameworks
- Web site books
- Web site development on your own computer
- Webmin or phpMyAdmin or cPanel for creating databases?
- aiki framework
- jQuery
- Views development - Learn Fields first
- Views development - Learn Actions and Rules
- jQuery .each()
- jQuery .has()
- jQuery .is()
- jQuery and Firefox Firebug
- jQuery children
- jQuery for people not using Drupal - Installation and getting started
- jQuery hover
- jQuery hover de-duplication example
- jQuery or CSS?
- jQuery performance
- jQuery tests
- Web site hosting
- Westpac Web site still broken after two years and ten months
- Wordpress wins another CMS survey
- Drupal
Symfony
Submitted by Peter on Thu, 2011-02-03 10:16
Symfony 2 requires PHP 5.3 and PDO, making Symfony 2 one of the most up to date PHP development frameworks in terms of requirements. The older Symfony 1.4 requires PHP 5.2.4 and might be a good choice if you cannot update PHP.
Download Symfony from www.symfony-project.org. There is an introductory tutorial and it is worth a read before installing Symfony. There a current 1.4 download and a preview of Symfony version 2, for which there might be less documentation. Symfony 2 is expected to replace 1.4 as the current product by the end of March 2011.
Requirements
Symfony 1.4 requires PHP 5.2.4 or higher but not 5.2.9. PHP 5.2 is the most common recent version of PHP. PHP 5.3 is rapidly replacing 5.2 and should be the minimum starting point for new projects in 2011. As a comparison, the Drupal content management system version 6 requires PHP 5.2 and the recently released Drupal 7 requires PHP 5.3. Symfony 2 uses PHP 5.3.2 or later.
Symfony uses PDO for database access, the same as Drupal 7 and other up to date software, giving you access to all the important databases, MySQL, INNODB, SQLite, and PostgreSQL. PDO requires an additional module for the specific database. For example, you install PDO-mysql for MySQL.
The PHP XML module is optional and the use is not specified so install it. You also need the PHP utf8_decode function that is supplied in the standard XML module. PHP 5 arrives with XML as a standard part of the install.
Symfony uses ORM, Object-Relational Mapping, and 1.4 gives you the choice of Propel or Doctrine. Propel requires the PHP XSL module. Doctrine uses YAML and might require the PHP YAML module. Symfony 2 uses Doctrine with no option for Propel.
Symfony requires the standard built in PHP Iconv and Tokenizer functions. You need the Multibyte module, something needed by almost all modern applications, but is not yet built in to PHP.
The PHP posix_isatty function is required to add colour to command line messages, a completely unnecessary feature. posix_isatty is part of the standard PHP Posix module installed by default but not installed by default on some of my computers and not available as an option on those computers.
session.auto_start is set to off in php.ini. When a PHP session starts, headers are sent to the Web browser that stop you from redirecting users to another page. Switching auto start off is standard for most Web sites. In some sites I use code to read the session in a way that still lets you redirect.
Your php.ini should have the standard defaults, short_open_tag off, magic_quotes_gpc off, and register_globals off. An ancient version of PHP had these settings on and I wrote extensively about the problems the settings caused. Eventually the PHP developers switched the settings off but some dinosaur software still expects the settings to be on.
A PHP code cache, commonly called an accelerator, is useful. APC is built into PHP 6 so use APC. APC is a one click install for PHP under Windows, just select APC in extensions. If PHP is already installed in Windows but not APC, select the Windows Control Panel, Add or Remove Programs, PHP, then Change.
Features
Command line interface?
Symfony list a command line interface as an advantage instead of a throwback to the days when dinosaurs had to use teletype. A command line interface is usually included in an application to make up for bad design or lack of development or as a comfort factor for people raised in the caves of 1980s Unix or 1970s DOS.
Copying everyone else
The propaganda for Symphony 2 is a long string of just like ... where ... is often Java or something designed for Java. Java code is inefficient because of the limited data types and PHP code kills Java for efficiency when tested in comparable situations using the easiest to write code for each language. Artificially restricting PHP code to Java emulation is not good practice.
Java is so difficult to teach that most teachers resort to code templates commonly called design patterns. I suffered through one term of that rubbish at one university. If you start with a proper design for the language you are going to use, they type of data you use, and they way the data is used, the PHP design is easier because you can use data types to match your data, the PHP code is easier for the same reason, and the result is faster for the same reason.
Copying Java and Java applications might be an advantage when you sell a framework to a company already using Java but it is not the best choice for everyone else. Witness the success of all the PHP based applications not emulating Java.
Environments
Symfony 2 arrives with predefined environments for several stages of application development, development, test, staging, and production. Test and staging overlap with Q&A, depending on your development process. Test is usually testing for functionality and then passes to end user testing. Staging is often volume testing for performance then for training.
MIT license
Most open source applications restrict you to the GPL or a similar license, ensuring you have free software but are not free to use it your way. BSD and MIT style licenses also give you the freedom to use software your way, including building commercial applications on top then distributing the result as your product.
ORM
ORM is a good idea when using a variety of databases because ORM lets you define the data layout once then apply it to the chosen database then switch to another database later without redefining data. Symfony 1.4 gives you the choice of Doctrine or Propel, while Symfony focuses on Doctrine.
Propel is oriented toward performance. Doctrine is oriented towards features. Some people start with Propel then switch to Doctrine when they develop complex databases. Others switch from Doctrine to Propel because Doctrine is too slow. Beginners will have more success with Doctrine because Doctrine has better documentation.
Performance tests show some queries are similar in both products while other queries can be five or ten times slower in Doctrine. Propel is, in turn, slower than feeding SQL direct into PDO. There are ways to make Doctrine queries faster. Both Doctrine and Propel have new releases with significant changes. Propel 1.5 is slight faster than 1.4 for similar queries and slightly slower when you use the extra features in 1.5. There is a Doctrine 2 that is faster
but nobody is publishing speed comparisons.
Given the speed difference, I am happy to write queries direct in SQL to bypass the ORMs for frequently used queries. I might try Propel 1.5 first if the documentation is improved.
PDO
Symfony uses PDO for database access. PDO works with all the important databases, MySQL, INNODB, SQLite, and PostgreSQL. PDO also works with the expensive Oracle and with less expensive commercial alternatives. PDO gives you basic database compatibility but you still have to write different SQL for each database when performing complicated operations. Some databases default to non standard date formats and require special settings to force standard dates in SQL.
Profiler
When you are testing, you can get a quick useful summary from the Symfony Profiler tool. The tool overlaps Firebug and some other tools.
Speed
Symfony claim Symfony 2 is three times faster than Symfony 1.4 and publish two speed tests, one showing 2 as 2 times faster than 1.4 and the other showing 2 is 2.5 times faster than 1.4. Neither speed test uses a database, the critical issue now they offer only Doctrine.
The same speed tests show Symfony 2 is faster than a lot of other frameworks but only when not using a database, an almost useless comparison.
Twig
There are a heap of output template programming languages and Symfony uses Twig. Many claim to eliminate programming then proceed to demonstrate how you program using their language. Symfony offers Twig and PHP as two equal alternatives and both produce the same result with a similar effort and similar code within the boundaries of what Twig can do. For anything more complicated, PHP is the choice and can be wrapped around Twig.
Symfony uses the Model View Controller approach, the templating should be in the view and everything else should be in the model or controller. Any complex data handling should be outside the view, outside what Twig does, but complex dynamic themes require a lot of changes in the view, resulting in most of the themeing occurring in the controller instead of the view. Effectively you have a view assembling a bunch of other views. In Symfony with Twig, each individual view can be Twig or PHP based.
Web Debug Toolbar
This is a nice debugging tool to use along with Firebug and a couple of other tools.
Other considerations
The Symfony introduction tutorial shows a session based on cookies instead of a database. There is very little in the introduction about databases and a modern application, Web or not Web based, is useless without a database. You have to test Symfony through to the point of creating a database with several tables and some joins before you find out what Symfony is really like.
The same introduction shows many little control files with the control files written in PHP, XML, and YAML. XML makes sense for some things but not for general use as a control file language. YAML looks like an interesting attempt at a control file language. There are some things that are too complicated for YAML or XML and have to be written in PHP. You do not want half your application in PHP then part in YAML and part in XML. PHP has the best features for speeding up interpretation and should be your first choice with XML used only when supplied from an external application.
Alternatives
CakePHP
CakePHP is a framework started around the same time as Symfony. The CakePHP Web site is more complex than the Symfony Web site and is slower in in some parts. It is hard to tell if it is CakePHP or the content or the server making the Web site slower. CakePHP has an impressive list of reference sites and many of them work far better than the CakePHP site.
I have looked at CakePHP in the past for several projects and gave up. CakePHP is, like several of the alternatives, about to launch a brand new version than might be better. The new CakePHP version 2 lifts the minimum PHP requirement from 4 to 5.2, bringing CakePHP up to Symfony 1.4 and Drupal 6 but not up to Symfony 2 or Drupal 7. If you use CakePHP, start from version 2.
CodeIgniter
CodeIgniter is designed to be small, lightweight, and fast. CodeIgniter has lots of reference sites and many are fast. CodeIgniter can work direct with databases or through Doctrine. CodeIgniter version 2 is already out and has PHP 5.1 as the minimum requirement. (PHP 5.2 has some serious improvements so use the latest 5.2.)
DooPHP
The new kid on the PHP framework block. Fast compared to the other frameworks over a year ago, it needs comparison to all the new versions of the other frameworks. Lots of relevant features but beginner level documentation is missing for many of the features.
Horde
Horde is a framework and is supplied with some ready built applications including an email application. There are people using the prebuilt applications. I do not know anyone using the framework for new applications.
Kajona
Kajona started in German and is now in English plus a few other European languages. The API documentation is excellent as is the ready to use administrative interface. If you want a framework and want a shortcut into a working Web site, choose Kajona.
Kohana
Kohana was originally based on CodeIgniter and has some similar characteristics. Kohana uses HMVC instead of MVC, allowing the splitting of a Web page presentation into a lot of little presentations, similar to the way Drupal handles pages when using blocks or the way you might build a page for Web 4. (Request my Web 4.0 presentation for your next conference, board meeting, or a workshop for your marketing and IT areas.)
Lithium
Lithium is a branch from CakePHP. Lithium is a rewrite to use PHP 5.3 and almost every new feature of PHP. Some of those new features have a big performance impact and one of the reasons some other frameworks went the other way.
Qcodo
Another framework with some impressive reference Web sites.
QCubed
QCubed is a branch of Qcodo with jQuery replacing a lot of custom Javascript.
Seagull
Compatible with the ancient PHP 4, Seagull looks like a fancy packaging of the old PEAR stuff with some sample code to create example applications. It is obsolete.
Yii
Yii claim their framework is fast, secure, and professional. Some of the other frameworks show benchmarks against Yii and Yii is middle of the road, not fast. Yii use a coding approach known variously as ONCE, DRY, DIE, and SSoT. You write code once then use it everywhere without repetition. Taken to the extreme, you end up with a lot of little functions calling each other and a significant overhead from the function calls, removing the option to be a fast framework.
Zend Framework
Zend Framework is going through a rewrite for a version 2 to, in part, remove some of the stupid ideas from version 1. The changes for Zend Framework version 2 have some parallels to the changes in Symfony version 2. One advantage of Simfony over some other frameworks is the ability to work with the Zend Framework.








