Posted on July 6th, 2010 at 9:34pm in
Code,
Reviews -
View Comments
I was recently asked to review Packt Publishing’s new book, CodeIgniter 1.7: Professional Development, by fellow CodeIgniter community member, Adam Griffiths. Adam is a well-known developer in the CI community, who, despite his young age, has become well-known among the ranks of CodeIgniter developers with his open source contributions.
I’m always excited to see new CodeIgniter books published, as the framework is growing in popularity and credibility among PHP developers, with applications springing up across the Internet. The framework is known for its excellent user guide and a strong community backing. But sometimes the resources available aren’t quite enough to make the concepts click in a new developer’s mind.
For me, the process involved viewing some of the available screencasts and looking at code that other had written in their applications. It wasn’t hard, but Adam’s new book would have been helpful to me in those early days of development with CodeIgniter. A selection of other CI-focused books have been published in the past, but I haven’t found many to be as practical as Adam’s. In previous books, often a single sample project is selected and used throughout the book to explain all of the concepts.
Adam’s approach is quite different and takes a look at various pieces of functionality that application developers might find very useful, while not walking them through the entire process of building an example application.
Specifically, Adam’s examples of using Twitter and Facebook authentication as well as accessing RESTful web services prove very useful, as these functions are increasingly at the core of many applications being built today.
The book also spends a bit of time talking about the basics of style in PHP coding. A guide like this would have helped to alleviate the evolution of coding style I’ve experienced as I’ve spent more and more time building web applications. It provides a solid baseline, referencing the CodeIgniter documentation’s style guide as a resource for maintaining code consistency.
Overall, I think that CodeIgniter 1.7: Professional Development fills a void in the market for CodeIgniter resources. I’d certainly recommend it to someone just starting out with the framework as an additional resource to use alongside the various other community resources.
The new book is not without its flaws though. As good as it is at helping a new developer get started at building all parts of an application: models, views, controllers and libraries, the one piece that’s lacking is advice on how to integrate with other people’s code. There a wealth of pre-written code out there, which though it may not be built to work with CodeIgniter, can save developers a ton of time as they build applications—if they know how to properly connect with third-party libraries from within the CodeIgniter framework. It can be a little bit tricky at first, so a primer in that area would be ideal.
Additionally, opening up the book with a bit of prior PHP experience is advised. Sometimes the examples don’t fully explain what’s going on in the code, so it could be a little complicated for a complete beginner.
Overall, though, I’m impressed with the direction this book goes. The angle is good, with a focus outside of the typical ‘build a blog in 20 minutes’ example.
Posted on April 9th, 2010 at 10:17pm in
Code -
View Comments
In my last post, I talked about my thoughts on moving API output in CodeIgniter to the View. Well, here’s the code for it. It’s fairly simple.
A couple little notes:
- Using this view requires the PEAR XML Serializer library. Assuming your PEAR libraries are in your path settings, the view should work. You may need to adjust the path to the libary, though, on line 56.
- This code isn’t meant to be pretty. In most cases, your views get laid out with as little PHP code as possible, making it easy to style them. This is a different kind of view. It’s only purpose is to make API output use the same syntax as loading any other view. Because of this, this view does lots of nasty things that you should NEVER do in a normal view. This is your disclaimer. I created this for my own purposes to work the way I wanted it to, and if you have objections, it’s certainly understandable, but I don’t really care.
Anyway, without further ado, if I haven’t scared you away, why don’t you give it a try?
Download the API View
Posted on April 5th, 2010 at 8:48am in
Code -
View Comments
Most everyone knows I’m not a Rails guy, and that’s probably never going to change, much to many of my colleague’s dismay.
I do, however, appreciate many of the features of Rails. The one on which I’m going to focus today is its built-in ability to show output in various formats.
My beloved framework, CodeIgniter, doesn’t have this capability built in, and in my development travels, I’ve handled API output in a variety of ways. All of them work just fine, but they really didn’t conform to the MVC architecture. API output, at least how I see it, should be sent to the browser through a view, just like any other sort of output.
A week or so ago, I created a helper that handled all the necessary API output stuff, including converting to JSON or XML. It worked just fine, but I found myself having to refer to the syntax a lot, every time I wanted to use it. It was just too cumbersome. And at about the same time, I began thinking how nice it’d be to use the familiar $this->load->view(); view loader method for APIs, too.
So, that’s just what I did. I took some of the logic from the helper and piled it into a one-size-fits-all view for APIs. It’s a little odd at first, when you look it it, since there’s a whole lot of code, which you don’t usually find in a view file, but, considering you never have to touch any of it directly, it works quite nicely.
I’ll post the code later on, but I just share my thoughts about this method of handling API output from CodeIgniter.
Posted on March 1st, 2010 at 9:24pm in
Code -
View Comments
Today I was searching around for a good vCard library to use for an application I’m currently building.
I came across a library by Carlos Alcala in the CodeIgniter Wiki. I wasn’t completely satisfied with the library as it was written, so I took the liberty of rewriting it to meet my own personal taste.
You can take it or leave it, but I’m quite happy with the result. I’m not going to go over it here in detail, as the comments are fairly self-explanatory, and a sample controller file is included, demonstrating various usage of the library.
Download CodeIgniter vCard Library .zip file
Posted on December 3rd, 2008 at 3:17pm in
Code -
View Comments
This is like a dream come true.. Christmas for a CI developer…
Check out CodeIgniter Advent on Michael Wales’ site.
I found today’s post, about protecting against CSRF exploitation extremely useful, and I look forward to seeing the rest of the series.