1. Go to this page and download the library: Download phore/orm 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/ */
phore / orm example snippets
namespace App\Entity;
use Phore\MiniSql\Schema\OrmClassSchema;
class User
{
public int $id;
public string $name;
public string $email;
public static function __schema(): OrmClassSchema
{
return new OrmClassSchema(
tableName: 'users',
primaryKey: 'id',
autoincrement: true,
columns: [
'id' => 'int',
'name' => 'varchar(255)',
'email' => 'varchar(255)'
]
);
}
}
use Phore\MiniSql\Orm;
use App\Entity\User;
$orm = new Orm([User::class], 'mysql:host=localhost;dbname=testdb;user=root;password=root');
$orm->connect();