Thursday, January 1, 2009

PHP 5.3 Data Structures - A chance for web frameworks

A few days ago Johannes Schlüter did a blogpost about Datastructures which will be introduced in PHP5.3 via the SPL extension. He also talks about the new type SplFixedArray which only uses numeric indexes. Web Frameworks like symfony can benefit from Datastructures because in many places of the code arrays are used to organize information. These informations (like routing tables, class path tables, etc.) can be stored in types that fit to the needs of the information structure which gives a wanted limitation in my opinion. But more important is the boost in performance because these types are developed in C and not in userland code. Also these new types only have to care about what they are intended to do. As an example SplFixedArray can work much faster because it only has to care about indexes as numerics. Maybe the core team will use these new types and we'll see them in one of the coming versions of symfony or another Web Framework.

Using YUI with symfony 1.2 - Part 1

In this series of tutorials i will describe the features of the ysfYUIPlugin which adds YUI support to your symfony applications. Today i will just install the plugin and give you the chance to play around with the plugin after that. In the following tutorials i will show you the features of the plugin and how you can speed up your javascript development using it.

If you are using symfony and want to add js functionality to your website you have the choice of a large number of js frameworks. My framework of choice is nearly always the Yahoo! User Interface Library which is - thanks to Dustin Whittle - available as a plugin in symfony 1.1 and 1.2. Using this plugin you can easily use the complete library of YUI plus some cool symfony helpers to speed up your development.

To install the plugin you can check out a copy from symfonys plugin repository or include it to your svn:externals to the plugins directory
svn co http://svn.symfony-project.com/plugins/ysfYUIPlugin/branches/1.2 /path/to/project/plugins/ysfYUIPlugin
After you checked out the plugin create a symlink at web/static/ysf that points to plugins/ysfYUIPlugin/web/static.

Next add the YUI helper to you settings.yml:
    all:
# Helpers included in all templates by default
standard_helpers: [Partial, Cache, I18N, Form, YUI]
Now you're ready to use the plugin and you can play around with it until the next tutorial will be published. In the next tutorial i will cover the use of the ysfYUIPlugin Web Debug Toolbar.