1. Go to this page and download the library: Download yii1x/active-record 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/ */
yii1x / active-record example snippets
use Yii1x\ActiveRecord\ORMContext;
ORMContext::bootstrap($container, debug: false);
#[Database(name: 'db_name')]
class User extends ActiveRecord
{
// ...
}
use Yii1x\ActiveRecord\ActiveRecord;
use Yii1x\ActiveRecord\Attributes\Table;
use Yii1x\ActiveRecord\Attributes\Database;
#[Table(name: 'user')]
#[Database(name: 'db_name')]
class User extends ActiveRecord
{
public function relations(): array
{
return [
'posts' => [self::HAS_MANY, Post::class, 'user_id'],
];
}
}