Tag Archives: CodeIgniter

CodeIgniter 2.0 Released: No More PHP4 Support!

EllisLab just released version 2.0.0 of the CodeIgniter PHP framework. There are a few interesting new additions, such as a cache driver with APC and memcache support, the option to let controller handle 404 errors, and the deprecation and removal of Scaffolding.

Perhaps the best news is that PHP4 support is being dropped in favor of a minimum version of PHP 5.1. Hopefully this means we will see CodeIgniter move towards a more object-oriented approach, like its spinoff/fork Kohana.

Also, CodeIgniter is being split into two branches: Core and Reactor. Core will be a slowly-updated branch that EllisLab will use for their products (e.g. ExpressionEngine), freeing up the primary community-driven Reactor branch to be more quickly developed.

CodeIgniter 2.0.0 Released [CodeIgniter]

Working with RESTful Services in CodeIgniter

The modern web is full of APIs. Many interesting sites have been created by mashing up data sources from multiple “Web 2.0″ sites.

Net.Tuts+ has a new tutorial on Working with RESTful Services in CodeIgniter. I found it to be quite an interesting read, as it covers both accessing RESTful APIs and creating your own.

If you have been following the CodeIgniter From Scratch series you will know by now that it is relatively quick and easy to put together simple web applications, such as blogs, CMS systems, brochure sites, etc. One thing you may not have thought about is using CodeIgniter to create an interactive API. After trying several existing REST implementations, I found they not only lacked simplicity but were missing most of the features you would expect from a RESTful implementation; so I built my own. This tutorial will show you how to use this code to set up your REST API, and gives example of how to interact with it from your web application.

I’m always amazed by how simple it is to create fairly advanced applications with frameworks like CodeIgniter. It does take a little bit of practice to get used to coding within the guidelines, such as properly utilizing the MVC structure, but once you get the hang of it you can whip things up really fast.

What Are the Advantages of a PHP Framework?

CodeIgniter. CakePHP. Kohana.

There’s no shortage of PHP frameworks…but why should you use one? What are the major advantages?

  • MVC – The Model-View-Controller architectural pattern helps you tier your code for easier maintenance. By keeping the data-manipulating logic separate from the bits that handle the display, you make it much easier to change either the template or the underlying code without touching the other.
  • Bundled classes – A framework includes classes and helper functions for common tasks, such as database access, pagination, and form handling. Not to mention smaller things, like truncating text to a specific word/character count.
  • Rapid development – Frameworks help you create a small to medium-sized application much quicker than if you wrote everything from scratch. If you’re in a hurry, using a framework will help you finish things before you reach that looming deadline.

If you’re a total DIY type, you don’t even need to rely on a third-party PHP framework. You could assemble on yourself, one that’s more specific to the projects you work on.

Kohana: Cleaner CodeIgniter For PHP 5

KohanaOne of the major criticisms of the CodeIgniter PHP framework is its continued support for PHP 4. The developers of the language announced two years ago that PHP 4 development, security patches included, would cease by the end of 2007. The CodeIgniter project still insists on supporting the outmoded PHP version, because far too many shared hosting providers still haven’t upgraded their machines for fear of breaking peoples’ poorly-coded scripts.

While CodeIgniter’s legacy support doesn’t stop you from using PHP 5-specific features in your applications, it does make things a bit less…elegant. If you’re going to build a sports car, would you put an old, less-efficient engine inside it?

Enter Kohana, “the swift PHP framework.”

Kohana is a fork of CodeIgniter, but entirely rewritten to be strict PHP 5 OOP. There are some different conventions, but overall the frameworks are similar enough that migrating is relatively painless. I’m still reading through the documentation, but it seems like it’s definitely worth looking into. Some of you may prefer CodeIgniter for their larger community, but it you’re a developer who has ever been frustrated by CodeIgniter’s decision, then you definitely want to have a look at Kohana.