1. Go to this page and download the library: Download sirix/cycle-orm-factory 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/ */
sirix / cycle-orm-factory example snippets
declare(strict_types=1);
use Cycle\Database\Config;
use Psr\Cache\CacheItemPoolInterface;
use Sirix\Cycle\Enum\SchemaProperty;
return [
'cycle' => [
'db-config' => [
'default' => 'default',
'databases' => [
'default' => [
'connection' => 'mysql',
]
],
'connections' => [
'mysql' => new Config\MySQLDriverConfig(
connection: new Config\MySQL\TcpConnectionConfig(
database: 'cycle-orm',
host: '127.0.0.1',
port: 3306,
user: 'cycle',
password: 'password'
),
reconnect: true,
timezone: 'UTC',
queryCache: true,
),
]
],
'migrator' => [
'directory' => 'db/migrations',
'table' => 'migrations',
'seed-directory' => 'db/seeds',
],
'entities' => [
'src/App/src/Entity', // The 'entities' configuration must always be present and point to an existing directory, even when working with manual entities.
],
'schema' => [
'property' => SchemaProperty::GenerateMigrations,
'cache' => [
'enabled' => true,
'key' => 'cycle_cached_schema', // optional parameter
'service' => CacheItemPoolInterface::class, // optional parameter if psr container have 'cache' CacheItemPoolInterface service
]
],
],
];