PHP code example of cycle / schema-provider

1. Go to this page and download the library: Download cycle/schema-provider 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/ */

    

cycle / schema-provider example snippets


use Cycle\ORM\Schema;
use Cycle\Schema\Provider\FromFilesSchemaProvider;
use Cycle\Schema\Provider\SimpleCacheSchemaProvider;
use Cycle\Schema\Provider\Support\SchemaProviderPipeline;

$pipeline = (new SchemaProviderPipeline($container))->withConfig([
    SimpleCacheSchemaProvider::class => SimpleCacheSchemaProvider::config(key: 'cycle-schema'),
    FromFilesSchemaProvider::class => FromFilesSchemaProvider::config(files: [
        'runtime/schema1.php',
        'runtime/schema2.php',
    ]),
]);

$schema = new Schema($pipeline->read());

use Cycle\ORM\Schema;
use Cycle\Schema\Provider\FromFilesSchemaProvider;
use Cycle\Schema\Provider\SimpleCacheSchemaProvider;
use Cycle\Schema\Provider\MergeSchemaProvider;
use Cycle\Schema\Provider\Support\SchemaProviderPipeline;

$pipeline = (new SchemaProviderPipeline($container))->withConfig([
    SimpleCacheSchemaProvider::class => SimpleCacheSchemaProvider::config(key: 'cycle-schema'),
    MergeSchemaProvider::class => [
        FromFilesSchemaProvider::class => FromFilesSchemaProvider::config(files: [
            'runtime/schema1.php',
            'runtime/schema2.php',
        ]),
        CustomSchemaProvider::class => ['some' => 'config'],
    ],
]);

$schema = new Schema($pipeline->read());