Laravel Repository Pattern: A Full Base Repository Example for Laravel 4

The repository pattern is gaining popularity in the PHP community these days. Here is a Base Repository class you can use to build your own implementation.

Simple CodeIgniter 2+ Messaging: MessageCI Spark

CodeIgniter Logo

I am pleased to announce my latest CodeIgniter Spark, MessageCI. MessageCI is quite possibly the simplest messaging library currently available for CodeIgniter. It makes no assumptions about your ORM or database code, application themes, CSS, views, models or anything else. It simply gets out of your way to you can get down to business.

Download MessageCI from Github

Set a Message

Detect an event to which you want to alert the user. For this example, we will assume a form has been POSTed and form validation failed.

Display a Message

Display a message to the user in a view. CSS styles are configured via the config file to decouple logic from presentation. If there are no messages set, nothing happens, so you can safely embed this code in every view without worrying about detecting messages.

CodeIgniter 2+ .htaccess file

htaccess

This is a general purpose .htaccess file for CodeIgniter. You can do all kinds of interesting things with an .htaccess file, but this one primarily rewrites URLs so you can remove index.php from your URL structure. This file also servers as a good foundation from which to build more complex .htaccess rules.

Haystack: an IndexTank client for CodeIgniter 2.0+

IndexTank

Update: The IndexTank service is no longer in operation. They were bought by LinkedIn and have closed their API and services to all existing and new customers. However, the good folks at IndexTank have open sourced their entire platform, and several great companies have been created to continue to service IndexTank customers. They are all completely compatible with my Haystack library as well as any existing IndexTank code you have written.

Take a moment to check out these great new companies:

The IndexTank API is a hosted search solution used by some of the largest sites on the web such as Reddit, Twitvid and ZenCoder. It offers some cool features such as Geolocation, fuzzy search, autocomplete, “Did you mean” spelling correction, stemming and most importantly, real-time indexing.

It’s a pretty cool service, and did I mention that it’s free to index up to 100,000 documents?

The only problem is that there wasn’t a PHP client available for the CodeIgniter framework, until now.

Haystack is a PHP client offering basic interaction with the IndexTank API, implemented as a CodeIgniter library. It is very much a work in progress, and as I wrote it primarily for use in my current project, it is not as general as it could be. I will be maintaining the library on Github and will continue to add new functionality and improvements as time allows.

You can download the library from my Github repository.

Basic Usage