Download the PHP package cycle/schema-provider without Composer
On this page you can find all versions of the php package cycle/schema-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cycle/schema-provider
More information about cycle/schema-provider
Files in cycle/schema-provider
Package schema-provider
Short Description Cycle ORM Schema providers
License MIT
Homepage https://cycle-orm.dev
Informations about the package schema-provider
Cycle ORM - Schema Provider
Cycle ORM uses an object implementing the Cycle\ORM\SchemaInterface
interface as a schema.
This schema can be constructed from a PHP array with a specific structure. The package at hand offers a comprehensive
solution for building a schema from different sources. It includes a collection of providers that implements the
Cycle\Schema\Provider\SchemaProviderInterface
interface. These providers are grouped in the
Cycle\Schema\Provider\Support\SchemaProviderPipeline
.
This pipeline orchestrates the execution of providers in a predetermined order, one after another. If one of the providers returns the schema, subsequent providers are not executed.
Requirements
Make sure that your server is configured with the following PHP versions and extensions:
- PHP >=8.0
Installation
You can install the package via Composer:
Usage
Let's explore a straightforward example of schema creation using this package. For example, we have a schema in
two php files schema1.php and schema2.php. In this scenario, we can use the
Cycle\Schema\Provider\FromFilesSchemaProvider
to build the schema from multiple files. Before this provider,
we can add a Cycle\Schema\Provider\SimpleCacheSchemaProvider
, capable of caching the schema. Upon subsequent schema
builds, this provider retrieves the schema from the cache, eliminating the need to build the schema using
FromFilesSchemaProvider
.
The SimpleCacheSchemaProvider
requires an implementation of Psr\SimpleCache\CacheInterface
, which must be defined
in your container. It uses this interface to retrieve and store the schema array. Alternatively, you can use the
Cycle\Schema\Provider\PhpFileSchemaProvider
, which can save the schema to a PHP file.
Building DB schema from different providers
To merge schema parts obtained from different providers, use Cycle\Schema\Provider\MergeSchemaProvider
.
License
The MIT License (MIT). Please see LICENSE
for more information.
Maintained by Spiral Scout.
All versions of schema-provider with dependencies
psr/simple-cache Version ^2.0 || ^3.0
psr/container Version ^1.0 || ^2.0
webmozart/glob Version ^4.6
spiral/files Version ^2.14 || ^3.11
cycle/orm Version ^2.0
cycle/schema-renderer Version ^1.2