27th June 2006
I've been really really busy at work recently. With end of month coming up, we've been looking to complete jobs that can be invoiced this month, reduce work on jobs that won't be invoiced this month and add in a few "quick" jobs that can be invoiced this month. Can you tell that worrying about cashflow is part and parcel of being in a small company?!
One result of all this is that I haven't been able to do anything outside of work, programming-wise at least. (I still have to mow the lawn and deal with the kids, of course!) Thus I've missed out on having a good look at Zend_Controller_RewriteRouter which is sitting in the Zend Framework's incubator. This is looking pretty damn good in my opinion and I'm really looking forward to having the time (next month!) to get my teeth into it.
The tests and the proposal provide an insight into how to use the class for those who can't wait for the official docs to catch up :)
Im other news, the Zend Framework has a new set of developer tools that are quite cool. They all integrate together and seem to be working quite well. The new system for handling proposals seems to have arrived just in time for "proposals week" too!
Posted in PHP, Zend Framework | No Comments »
13th June 2006
Everyone has their favourite coding editor and as this topic has just come up on the Zend mailing list and comes up regularly on the Sitepoint forums, I thought I'd list the editors I use.
For my main heavy lifting, I use Zend Studio. In my opinion, nothing can touch it's autocomplete functionality. I especially like the way that it uses phpdoc's @return construct for autocomplete on class objects that are returned from functions. Obviously, it has all the other features you'd expect like projects, syntax highlighting, find-in-files, code folding, etc. It also strips trailing spaces on save which I like. As it's an IDE, it also comes with debugging capabilties. The debugger is fairly powerful and most importantly worked straight out of the box for me. Not that I use it often - last time was trying to work out how ADOdb's schema code worked! It's also cross platform and has basic Subversion and CVS support.
There are only two major gripes that I have with Zend Studio: performance and single instance. It's a Java application and hence can be slow to respond for no apparent reason. I have no idea why Java apps are like this, but the most obvious case is restoring when the app has been minimised for 10 minutes. This is really really frustrating! The other issue I have is that you can only have one copy of Zend Studio open at any one time. Sometimes, I'd like to have two separate instances open with different projects in them, but I can't find a way to do this.
Enter UltraEdit. I use UltraEdit for when I need another project open at the same time as my main project in Zend Studio. UltraEdit is a really powerful text editor for Windows and I can't think of anything it can't do (except PHP autocompletion!). It also supports grouping of files into projects and you also get syntax highlighting, code folding, find-in-files, strip trailing spaces on save etc. And it's quick! It even supports ctags so once you have your ctags file created, you can jump straight to the function under the cursor. Very useful, but not autocompletion :) IDM, also make UltraStudio that has PHP autocompletion, but I've not used it so can't comment on if it's any good. It's a shame it's not cross platform.
My other editor is Vim! Vim is my "get things done" editor. I use it for just about all my other editing needs when I'm not doing major coding. I'm not sure that I need to say anything about Vim other than once you have learnt the interface, there's not a lot it can't do!
So there you have it, a short précis on why I use the editors I do.
Posted in PHP | 2 Comments »
4th June 2006
When casting around for another file format for Zend Config, I came up with XML or YAML. Obviously I posted to the mailing list for thoughts and Paul Jones suggested the completely obvious: PHP arrays!
Another one, perhaps so obvious it is invisible, is a PHP array. Simple, straightforward, fast, no parser needed, open to programmatic manipulation. If it has not already been implemented, it would be trivial to do so.
And he's right.
One of the nice things about the review process that the Zend_Config proposal went through is that the design is much better now. Essentially the loading of the file is separated from the accessing of config data. This means that writing new file loaders is that much simpler. In the case of Zend_Config_Array, it's all done in the load() function and boils down to:
include $filename;
return $config[$section];
Obviously, this relies on the config file having an associative array called $config with a top level key called $section. For the unit tests, the following config file is used:
<?php
$config['all'] = array(
'hostname' => 'all',
'name' => 'thisname',
'db' => array(
'host' => '127.0.0.1′,
'user' => 'username',
'pass' => 'password',
'name' => 'live',
),
'one' => array(
'two' => array(
'three' => 'multi'
)
)
);
$config['staging'] = $config['all'];
$config['staging']['hostname'] = 'staging';
$config['staging']['db']['name'] = 'dbstaging';
$config['staging']['debug'] = false;
$config['other_staging'] = $config['staging'];
$config['other_staging']['only_in'] = 'otherStaging';
$config['other_staging']['db']['pass'] = 'anotherpwd';
// invalid section
$config['extendserror'] = 123;
?>
As you can see, the "extends" keyword isn't required in when using PHP arrays for config as we can assign directly from one array to another which makes life very simple.
Posted in PHP, Zend Framework | No Comments »
1st June 2006
In case you missed it, the Zend Framework Subversion revision 532 is important as Darby has put in place the test harness fiiles required for testing the incubator code. Thanks Darby!
For the tests to pass you must have the following on your include path:
- /path/to/PEAR
- /path/to/zend_framework/library
- /path/to/zend_framework/incubator
- /path/to/zend_framework/tests
You can then run the tests from the incubator/tests directory using
php -f AllTests.php
. If you don't want to change your php.ini file, then
php -d include_path=".:/path/to/PEAR:/path/to/zend_framework/library:/path/to/zend_framework/incubator:/path/to/zend_framework/tests" -f AllTests.php
also works :)
Note that the tests fail in Zend_Cache at the moment though, so you'll want to comment out
$suite->addTest(Zend_Cache_AllTests::suite());
in incubator/tests/Zend/AllTest.php!
Posted in PHP, Zend Framework | 2 Comments »