1. Go to this page and download the library: Download sirmekus/ahia library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sirmekus / ahia example snippets
composer
use Sirmekus\Database\Model;
$model = new Model();
use Sirmekus\Database\Model;
$model = new Model($DB_HOST, $DB_USER, $DB_NAME, $DB_PASS);
use Sirmekus\Database\Model;
$model = new Model();
$model->table = "table";
//Fictious Class => TestTable.php
Sirmekus\Database\Model;
class TestTable extends Model
{
//The table name is 'test_table'. You don't need to add any property or method (unless you wish to add)
}
//Now you can use it like you would with the "Model" class => test.php
he table will be **"test_table"** and you can use every method defined in the parent class.
use Sirmekus\Database\Model;
$model = new Model();
$model->insert([
'name'=>"Sir Mekus",
"country"=>"Nigeria"
]);
//or, with name of table
$model->insert([
'name'=>"Sir Mekus",
"country"=>"Nigeria"
],
$table='developers'
);
use Sirmekus\Database\Model;
$model = new Model();
$model->name = "Sir Mekus";
$model->country = "Nigeria";
$model->save();