SMC (simple model for codeigniter) is a lightweight CRUD model for CodeIgniter.
Check out the Documentation on Bitbucket!
Advantages
- easy to install (2 files)
- easy to setup (just extend SMC_Model)
- easy to use (see below)
- short, readable syntax
- method chaining
- all based on CodeIgniters own active record class
Features
- OOP approach
- supports all active record methods
- often used methods implemented ( like find($column, $value) )
- magic constructor to inject values into a new instance
- wiki with a lot of documentation and examples
Current version: 1.2.1
Examples
// INSERT data
$user = new User();
$user->name = 'new user';
$user->email = 'user@mail.de';
$user->password = '123456';
$user->create();
// UPDATE data
$user = User::find('name', 'new user');
$user->password = 'new password';
$user->save();
// REMOVE data
$user = User::find('id', 1);
$user->remove();
// SELECT data
$users = User::query()->where('name', 'a user')->or_where('name', 'another user')->get();
// ITERATE RESULTS
foreach ($users as $user) {
$user->name = 'a new name';
$user->save();
}
