Installation
Composer Installation
Install via Composer:
composer require michalsn/codeigniter-relations
Manual Installation
If you prefer manual installation, follow these steps:
- Download this project
- Place the files in
app/ThirdParty/relationsdirectory - Enable the package by editing
app/Config/Autoload.php:
<?php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
class Autoload extends AutoloadConfig
{
// ...
public $psr4 = [
APP_NAMESPACE => APPPATH,
'Michalsn\CodeIgniterRelations' => APPPATH . 'ThirdParty/relations/src',
];
// ...
public $files = [
APPPATH . 'ThirdParty/relations/src/Common.php',
];
// ...
}
Verification
To verify the installation, create a simple model with the HasRelations trait:
<?php
namespace App\Models;
use CodeIgniter\Model;
use Michalsn\CodeIgniterRelations\Traits\HasRelations;
class UserModel extends Model
{
use HasRelations;
// ...
}
If no errors occur, the installation is successful.