{"id":18376424,"url":"https://github.com/cycle/schema-provider","last_synced_at":"2025-10-08T20:19:41.764Z","repository":{"id":220289281,"uuid":"597200737","full_name":"cycle/schema-provider","owner":"cycle","description":"The package provides the ability to build schema for Cycle ORM from different sources.","archived":false,"fork":false,"pushed_at":"2024-02-08T07:59:01.000Z","size":50,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"1.x","last_synced_at":"2025-10-08T20:19:41.006Z","etag":null,"topics":["cycle","orm","php","schema"],"latest_commit_sha":null,"homepage":"https://cycle-orm.dev","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cycle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"cycle"}},"created_at":"2023-02-03T21:15:46.000Z","updated_at":"2024-02-08T07:18:41.000Z","dependencies_parsed_at":"2024-11-06T00:26:43.323Z","dependency_job_id":"ed559002-37b0-449c-a8b4-d8b45fb0878c","html_url":"https://github.com/cycle/schema-provider","commit_stats":null,"previous_names":["cycle/schema-provider"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cycle/schema-provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycle","download_url":"https://codeload.github.com/cycle/schema-provider/tar.gz/refs/heads/1.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-provider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000662,"owners_count":26082817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cycle","orm","php","schema"],"created_at":"2024-11-06T00:23:17.717Z","updated_at":"2025-10-08T20:19:41.723Z","avatar_url":"https://github.com/cycle.png","language":"PHP","readme":"# Cycle ORM - Schema Provider\n\n[![PHP Version Require](https://poser.pugx.org/cycle/schema-provider/require/php)](https://packagist.org/packages/cycle/schema-provider)\n[![Latest Stable Version](https://poser.pugx.org/cycle/schema-provider/v/stable)](https://packagist.org/packages/cycle/schema-provider)\n[![phpunit](https://github.com/cycle/schema-provider/actions/workflows/phpunit.yml/badge.svg)](https://github.com/cycle/schema-provider/actions)\n[![psalm](https://github.com/cycle/schema-provider/actions/workflows/psalm.yml/badge.svg)](https://github.com/cycle/schema-provider/actions)\n[![Total Downloads](https://poser.pugx.org/cycle/schema-provider/downloads)](https://packagist.org/packages/cycle/schema-provider)\n[![psalm-level](https://shepherd.dev/github/cycle/schema-provider/level.svg)](https://shepherd.dev/github/cycle/schema-provider)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cycle/schema-provider/badges/quality-score.png?b=1.x)](https://scrutinizer-ci.com/g/cycle/schema-provider/?branch=1.x)\n[![Codecov](https://codecov.io/gh/cycle/schema-provider/graph/badge.svg)](https://codecov.io/gh/cycle/schema-provider)\n\u003ca href=\"https://discord.gg/TFeEmCs\"\u003e\u003cimg src=\"https://img.shields.io/badge/discord-chat-magenta.svg\"\u003e\u003c/a\u003e\n\n[Cycle ORM](https://github.com/cycle/orm) uses an object implementing the `Cycle\\ORM\\SchemaInterface` interface as a schema.\nThis schema can be constructed from a PHP array with a specific structure. The package at hand offers a comprehensive\nsolution for building a schema from different sources. It includes a collection of providers that implements the\n`Cycle\\Schema\\Provider\\SchemaProviderInterface` interface. These providers are grouped in the\n`Cycle\\Schema\\Provider\\Support\\SchemaProviderPipeline`.\n\nThis pipeline orchestrates the execution of providers in a predetermined order, one after another.\nIf one of the providers returns the schema, subsequent providers are not executed.\n\n## Requirements\n\nMake sure that your server is configured with the following PHP versions and extensions:\n\n- PHP \u003e=8.0\n\n## Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require cycle/schema-provider\n```\n\n## Usage\n\nLet's explore a straightforward example of schema creation using this package. For example, we have a schema in\ntwo php files **schema1.php** and **schema2.php**. In this scenario, we can use the\n`Cycle\\Schema\\Provider\\FromFilesSchemaProvider` to build the schema from multiple files. Before this provider,\nwe can add a `Cycle\\Schema\\Provider\\SimpleCacheSchemaProvider`, capable of caching the schema. Upon subsequent schema\nbuilds, this provider retrieves the schema from the cache, eliminating the need to build the schema using\n`FromFilesSchemaProvider`.\n\n```php\nuse Cycle\\ORM\\Schema;\nuse Cycle\\Schema\\Provider\\FromFilesSchemaProvider;\nuse Cycle\\Schema\\Provider\\SimpleCacheSchemaProvider;\nuse Cycle\\Schema\\Provider\\Support\\SchemaProviderPipeline;\n\n$pipeline = (new SchemaProviderPipeline($container))-\u003ewithConfig([\n    SimpleCacheSchemaProvider::class =\u003e SimpleCacheSchemaProvider::config(key: 'cycle-schema'),\n    FromFilesSchemaProvider::class =\u003e FromFilesSchemaProvider::config(files: [\n        'runtime/schema1.php',\n        'runtime/schema2.php',\n    ]),\n]);\n\n$schema = new Schema($pipeline-\u003eread());\n```\n\nThe `SimpleCacheSchemaProvider` requires an implementation of `Psr\\SimpleCache\\CacheInterface`, which must be defined\nin your container. It uses this interface to retrieve and store the schema array. Alternatively, you can use the\n`Cycle\\Schema\\Provider\\PhpFileSchemaProvider`, which can save the schema to a PHP file.\n\n\n### Building DB schema from different providers\n\nTo merge schema parts obtained from different providers, use `Cycle\\Schema\\Provider\\MergeSchemaProvider`.\n\n```php\nuse Cycle\\ORM\\Schema;\nuse Cycle\\Schema\\Provider\\FromFilesSchemaProvider;\nuse Cycle\\Schema\\Provider\\SimpleCacheSchemaProvider;\nuse Cycle\\Schema\\Provider\\MergeSchemaProvider;\nuse Cycle\\Schema\\Provider\\Support\\SchemaProviderPipeline;\n\n$pipeline = (new SchemaProviderPipeline($container))-\u003ewithConfig([\n    SimpleCacheSchemaProvider::class =\u003e SimpleCacheSchemaProvider::config(key: 'cycle-schema'),\n    MergeSchemaProvider::class =\u003e [\n        FromFilesSchemaProvider::class =\u003e FromFilesSchemaProvider::config(files: [\n            'runtime/schema1.php',\n            'runtime/schema2.php',\n        ]),\n        CustomSchemaProvider::class =\u003e ['some' =\u003e 'config'],\n    ],\n]);\n\n$schema = new Schema($pipeline-\u003eread());\n```\n\n## License\n\nThe MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information.\nMaintained by [Spiral Scout](https://spiralscout.com).\n","funding_links":["https://github.com/sponsors/cycle"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Fschema-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycle%2Fschema-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Fschema-provider/lists"}