Named Scopes with CodeIgniter

codeigniter, database, models, php

Named scopes are a really powerful feature of models - they allow you to define a clean, concise syntax when performing queries within your models - and best of all, are really easy to utilise in CodeIgniter.

Read more »

PHP5.3’s ?: expression

hints, php

I was digging through the PHP5.3 release info and came across a really neat little expression. It’s a simplified version of the “() ? : ;” expression, a handy little expression to use in variable assignment. The way this expression works is as follows:

Read more »

Setting up the perfect CodeIgniter & TDD environment

codeigniter, php, testing

As CodeIgniter has little built-in test support, it’s often difficult setting up a good environment to allow Test-driven Development using SimpleTest and the CodeIgniter framework. I’ve been using Ruby on Rails a lot recently, and I was inspired by the fantastic built in integration with unit, functional and integration tests, so when I returned to CodeIgniter, I delved into the deep dark world of setting up the perfect CodeIgniter and TDD environmen

Read more »

Searching CodeIgniter Apps with Sphinx

codeigniter, mysql, php

Due to popular demand, I’m writing this tutorial as a companion to my previous post, Searching SQL with Sphinx. In this tutorial I’m going to show you how to use the excellent Sphinx search engine to provide full-text search functionality to database-powered CodeIgniter ap

Read more »

Screen Scraping with PHP

hints, php

There are quite a few good screen scraping libraries available for PHP apps so that you can pull and parse a page, search for specific elements, enter data into and post forms et cetera, but if you just need to do a bit of screen-scraping work and you don’t need an entire library (or don’t want the additional overhead of another file to load), PHP has a few handy tricks up its sleeve to make this really easy.

Read more »