PHP

Call user function for magic method PHP

Put a bit of work into upgrading the blog and might as well make a quick post now. Heres a trick to test if a class variable exists, isset or has a particular value dynamically. Call the magic method __get() for the variable name which you can generate on the fly.

Read the rest of the post…

Rolling out an API for your cakePHP app Part 1: The Problems

Recently I've put a lot of work into an API solution for a cakePHP app which addresses some of the architectural issues of creating an API in a cakePHP project. To start with I threw together a nice simple API as a proof of concept and to showcase the ease at which an API can be created quickly using the RequestHandler component. While that solution was fine and incredibly quick to whip up, there are some issues when it comes time to extend the API, the biggest of which is versioning.

Read the rest of the post…

Rolling out an API for your cakePHP app Part 1: The Problems

Recently I've put a lot of work into an API solution for a cakePHP app which addresses some of the architectural issues of creating an API in a cakePHP project. To start with I threw together a nice simple API as a proof of concept and to showcase the ease at which an API can be created quickly using the RequestHandler component. While that solution was fine and incredibly quick to whip up, there are some issues when it comes time to extend the API, the biggest of which is versioning.

Read the rest of the post…

PHP Error Handling Class

Error handling is obviously fairly important so I have finally invested time into a custom error handling class for PHP 4 and above. It is a fairly small and simple class (only about 150 lines), I'm quite happy with it so far, of course you can download the class below and try it out for your self.

Read the rest of the post…

PHP Voting System to Increase your Inbound Links

Having some sort of web 2 point ohish interactive component on your website is a great way to generate buzz, get users coming back to the site and even generate inbound links. One such component I have seen work well is a voting system, made so much more popular by community driven sites such as digg, reddit etc.

Read the rest of the post…

Displaying File Permissions with PHP

For whatever reason you may need to display file permissions for one of your websites. I have thrown together a very basic script which will recursively (yay recursion) navigate your filesystem and save the folder/filenames and their respective file permissions into an associative array. The script then displays the array very basically.

Read the rest of the post…