Accessing CKAN data from PHP

I've been working on a couple of open data projects recently - which has been very rewarding.

A couple of people have asked for some code so I've knocked up a quick version of the sort of thing I've been working on.

This code requires PHP 5.1 for the JSON functions but doesn't need any extra libraries (pecl_http can give better error messages but is a bit of a pain to install).

The Notes field in packages returns output in Markdown format - you can convert this to HTMl with a parser available at http://michelf.com/projects/php-markdown

Read more

Make Drush support PHP-5.1

Drupal has a fairly easy to meet set of requirements http://drupal.org/node/502452

But Drupal projects are free to set their own rules in this area and Drush has used functions only available in PHP 5.2 - as far as I can see this is just the json functions.

Frustratingly the latest version of RedHat provides PHP 5.1 and this is the second time I've run into the problem with a client who uses RedHat and understandably wants to stick to the standard packages.

Read more

Multi-threaded PHP

OK so it isn't quite multi-threaded, but forking and controlling processes in the command line environment is still pretty powerful and something I've wanted to do on a couple of occasions.

http://brian.moonspot.net/php-fork

http://us.php.net/manual/en/book.pcntl.php

Read more

xdebug and Eclipse

xdebug is an immensely powerful tool for exploring what your code really does.

You can get a long way using print_r  but ultimately this always requires that you predict the path your code will take - and the tricky bit about debugging is you need it when your predications have gone wrong.

It's generally pretty easy to set up

Read more

Things to like about Symfony so far

A few days into learning Symfony and so far I'm keen on

  • configuration check to start with
  • good MVC separation
  • ability to generate initial MVC components from a database definition
  • form validation to match database constraints
  • wrapping various HTTP functions and globals in a request and response object
  • separate dev and prod environments
  • ajax integration - like defining a div as draggable in PHP
  • explicit support for initial and test data

Things not to like

Read more

Practical Symfony

Well having found the Definitive Guide to Symfony a bit uninspiring I've spent a bit of time on the "Practical Symfony" book - online.

http://www.symfony-project.org/jobeet/1_2/Propel/en/

So far it's great - the first "three days" lessons went by pretty quick, and I'm glad I'd done some background reading.

Putting the two things together I feel I've probably got enough understanding  to start writing a basic app - which is exactly what I need to do to make sense of a load of reading.

Read more

The Definitive Guide to Symfony

cover of The Definitive Guide to Symfony The Definitive Guide to Symfony (Expert's Voice in Open Source)
Fabien; Zaninotto, François Potencier
* *
£35.89

buy from amazon

 

I want to like this book because, having read it I'm still enthusiastic about learning symfony.

But normally when I read a book like this I feel inclined to try out bits of code as I go - and the layout of this book just isn't conducive to that.

I really don't like the way that the section on "the basics" doesn't even cover database connections, and code generation isn't covered till chapter 14.

Read more

Testing PHP

I had fun this weekend at the PHP London Test Fest, it was a great opportunity to learn something new and meet some great programmers.

Read more

Extending and Embedding PHP

cover of Extending and Embedding PHP Extending and Embedding PHP
Sara Golemon
* * * *
£45.86

buy from amazon

 

I can't claim to have read the whole of this book - but I have found parts of useful on occasions when I needed that deeper insight into how PHP works.

I have found it well written and very approachable for such a deeply technical book.

There doesn't seem to be much to compete with it - though please comment if I've missed something.

It's definitely on my TODO list for further reading.

Read more