PHPackages                             cycle/schema-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cycle/schema-provider

ActiveLibrary[Database &amp; ORM](/categories/database)

cycle/schema-provider
=====================

Cycle ORM Schema providers

1.0.0(2y ago)050.4k↑10.3%[1 issues](https://github.com/cycle/schema-provider/issues)4MITPHPPHP &gt;=8.0

Since Feb 5Pushed 2y ago4 watchersCompare

[ Source](https://github.com/cycle/schema-provider)[ Packagist](https://packagist.org/packages/cycle/schema-provider)[ Docs](https://cycle-orm.dev)[ GitHub Sponsors](https://github.com/sponsors/cycle)[ RSS](/packages/cycle-schema-provider/feed)WikiDiscussions 1.x Synced 1w ago

READMEChangelog (1)Dependencies (11)Versions (2)Used By (4)

Cycle ORM - Schema Provider
===========================

[](#cycle-orm---schema-provider)

[![PHP Version Require](https://camo.githubusercontent.com/f29a21f31359c275c6b70395a66a666f3a0612b6266b53091f6a90517c1ec50c/68747470733a2f2f706f7365722e707567782e6f72672f6379636c652f736368656d612d70726f76696465722f726571756972652f706870)](https://packagist.org/packages/cycle/schema-provider)[![Latest Stable Version](https://camo.githubusercontent.com/601a1a1aa58491411967d48a54eb0be38e95b30e5988ddd75c84fb757b95762a/68747470733a2f2f706f7365722e707567782e6f72672f6379636c652f736368656d612d70726f76696465722f762f737461626c65)](https://packagist.org/packages/cycle/schema-provider)[![phpunit](https://github.com/cycle/schema-provider/actions/workflows/phpunit.yml/badge.svg)](https://github.com/cycle/schema-provider/actions)[![psalm](https://github.com/cycle/schema-provider/actions/workflows/psalm.yml/badge.svg)](https://github.com/cycle/schema-provider/actions)[![Total Downloads](https://camo.githubusercontent.com/863a78a316503ef1be8d3c7f120029e7dec7e9d1799266ba34b710a6d6362f55/68747470733a2f2f706f7365722e707567782e6f72672f6379636c652f736368656d612d70726f76696465722f646f776e6c6f616473)](https://packagist.org/packages/cycle/schema-provider)[![psalm-level](https://camo.githubusercontent.com/b08d92da1f902941b76add10d6b7df61b9b9a40dad357ceb8627e9a57bd74253/68747470733a2f2f73686570686572642e6465762f6769746875622f6379636c652f736368656d612d70726f76696465722f6c6576656c2e737667)](https://shepherd.dev/github/cycle/schema-provider)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/943ea4139355bbafaf6809177a6c330b7387b9b6da6980b06622d6a7955263e3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6379636c652f736368656d612d70726f76696465722f6261646765732f7175616c6974792d73636f72652e706e673f623d312e78)](https://scrutinizer-ci.com/g/cycle/schema-provider/?branch=1.x)[![Codecov](https://camo.githubusercontent.com/ef9648139a7f8ec1c6da918dc519a8ff007453958b6c966fc2900334e7771a37/68747470733a2f2f636f6465636f762e696f2f67682f6379636c652f736368656d612d70726f76696465722f67726170682f62616467652e737667)](https://codecov.io/gh/cycle/schema-provider)[![](https://camo.githubusercontent.com/4442b73a11753b80fdd7b442ddbfaf8383902c8b9ffa66ed1718e8c62e102f2e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646973636f72642d636861742d6d6167656e74612e737667)](https://discord.gg/TFeEmCs)

[Cycle ORM](https://github.com/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
------------

[](#requirements)

Make sure that your server is configured with the following PHP versions and extensions:

- PHP &gt;=8.0

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require cycle/schema-provider
```

Usage
-----

[](#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`.

```
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());
```

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

[](#building-db-schema-from-different-providers)

To merge schema parts obtained from different providers, use `Cycle\Schema\Provider\MergeSchemaProvider`.

```
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());
```

License
-------

[](#license)

The MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [Spiral Scout](https://spiralscout.com).

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

855d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/796136?v=4)[Anton Tsitou](/maintainers/wolfy-j)[@wolfy-j](https://github.com/wolfy-j)

---

Top Contributors

[![msmakouz](https://avatars.githubusercontent.com/u/67324318?v=4)](https://github.com/msmakouz "msmakouz (8 commits)")[![roxblnfk](https://avatars.githubusercontent.com/u/4152481?v=4)](https://github.com/roxblnfk "roxblnfk (4 commits)")

---

Tags

cycleormphpschema

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cycle-schema-provider/health.svg)

```
[![Health](https://phpackages.com/badges/cycle-schema-provider/health.svg)](https://phpackages.com/packages/cycle-schema-provider)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.7k532.1M19.2k](/packages/laravel-framework)[cakephp/cakephp

The CakePHP framework

8.8k19.1M1.7k](/packages/cakephp-cakephp)[illuminate/contracts

The Illuminate Contracts package.

706127.7M12.4k](/packages/illuminate-contracts)[moonshine/moonshine

Laravel administration panel

1.3k239.9k72](/packages/moonshine-moonshine)[getgrav/grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS

15.5k85.4k1](/packages/getgrav-grav)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

744284.3k34](/packages/civicrm-civicrm-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
