The migrations in CodeIgniter or how to have a “Git” for your database (part 3 of 3: Using Matches for faster development)

Hmm… I don’t know about you but the two tutorials before this one in the series about migration really scared me with the naming, the controllers, the format of the migration, etc. So why not speed things up? We can do this by using Matches, a CodeIgniter CLI script that helps me speed things up when talking about development in CodeIgniter. I sure hope you didn’t just realize that this is also about promoting my script (which, by the way, it’s open source…). Continue reading

The migrations in CodeIgniter or how to have a “Git” for your database (part 2 of 3: Alter tables with Migrations in CodeIgniter)

(created at: July 23, 2015; last update: July 23, 2015)
Well… you got here. So I will be assuming that you’ve already followed the first episode of this tutorial ( and all went well up until the end. If something went wrong now is the time to tell me (in a comment to to previous tutorial, please).

Now we will go a bit deeper… So… By referring to what we did in the previous tutorial (a table named “users” that has “id”, “username”, “email”, and “password” as fields), we will try to see how we can alter the table the way we want to. Continue reading


The migrations in CodeIgniter or how to have a “Git” for your database (part 1 of 3)

(created at: July 22, 2015; last update: July 29, 2015)

Well… this title is a bit misleading, isn’t it? Let’s just start by talking about what is a Git.

Git is some sort of history tracker for your code. That is, whenever you modify something in your code, Git keeps a track of how the code looked before your update, and how it looks after the update. By using it, you and those that work with you can find out how the coding evolved and return to previous versions if something went wrong or want to create a new branch.

The same happens with the migrations, these being related to the database operations. Migrations help you and your team mates keep track of the changes you make to the database tables.

So let’s get to work and see how we can use them. Continue reading


Again about my Matches CLI – a CodeIgniter CLI script

When I work on an existing CodeIgniter project, I usually just copy/paste from previous work: if I need to create a new controller, I simply copy an existing controller that looks similar to what I want to do in the new controller and paste it as the new controller. After that I delete what I don’t need (sometimes that means about 75% of the copied code). Continue reading

How to handle security in POST or GET using CodeIgniter

Well… it’s a huge subject, and I don’t know if I’m the person to ask to regarding this subject, but a reader asked me to approach it. Let’s start with mentioning the features that CodeIgniter offer in this regard. Looking at the manual, we can clearly see that it covers a lot of subjects, including session handling, encryption, security, input, and form validation. Continue reading

The state of my MY_Model. Inserting data directly from forms with from_form() method

Well… it’s a mess, but it works good for now. And I think it’s evolving, one sign of this being the fact that 20 people stared it on the Github repository (

And now I’ve added a new method to it, namely from_form(), which, by using the form_validation library is taking the data to be inserted from the form. Continue reading

DATETIME validation in CodeIgniter or how to create your own validation rules with callbacks and/or extending the form validation library

I found myself wanting to validate an input field that will be used when inserting the POST values in a table. That input field would have to be a DATETIME type of value. That is to say that if someone will fill the value of an input field, let’s name the input field “published_at”, that value would have to have a DATETIME format: 2015-05-18 15:10:29. Continue reading

Revisiting the multilevel menu in PHP with some additional code (as in… Bootstrap CSS)

It’s been almost a year since I’ve posted a tutorial (Multi-level menu in PHP – how to do it without killing yourself or the database in the process) about how do create a multi-level menu in PHP, but in all that time I’ve never seen anyone complaining about some of the weak points of my approach. Continue reading