{"id":18376439,"url":"https://github.com/cycle/schema-builder","last_synced_at":"2025-04-06T01:10:27.482Z","repository":{"id":34241802,"uuid":"171269794","full_name":"cycle/schema-builder","owner":"cycle","description":"Declarative schema generation for Cycle ORM","archived":false,"fork":false,"pushed_at":"2024-12-13T15:53:08.000Z","size":589,"stargazers_count":16,"open_issues_count":10,"forks_count":12,"subscribers_count":6,"default_branch":"2.x","last_synced_at":"2025-03-30T00:09:53.401Z","etag":null,"topics":["cycle","datamapper","hacktoberfest","orm","php","schema"],"latest_commit_sha":null,"homepage":"","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":"2019-02-18T11:14:31.000Z","updated_at":"2025-03-29T21:33:39.000Z","dependencies_parsed_at":"2023-12-22T11:45:51.258Z","dependency_job_id":"401b42ac-76df-4f95-b650-710c63b21866","html_url":"https://github.com/cycle/schema-builder","commit_stats":{"total_commits":233,"total_committers":13,"mean_commits":"17.923076923076923","dds":0.3047210300429185,"last_synced_commit":"a639f4bf6bf03b855c150afaa8b3c611be47f826"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Fschema-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycle","download_url":"https://codeload.github.com/cycle/schema-builder/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419861,"owners_count":20936012,"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","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","datamapper","hacktoberfest","orm","php","schema"],"created_at":"2024-11-06T00:23:20.745Z","updated_at":"2025-04-06T01:10:27.462Z","avatar_url":"https://github.com/cycle.png","language":"PHP","readme":"# Cycle ORM - Schema Builder\n\n[![Latest Stable Version](https://poser.pugx.org/cycle/schema-builder/version)](https://packagist.org/packages/cycle/schema-builder)\n[![Build Status](https://github.com/cycle/schema-builder/workflows/build/badge.svg)](https://github.com/cycle/schema-builder/actions)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cycle/schema-builder/badges/quality-score.png?b=2.x)](https://scrutinizer-ci.com/g/cycle/schema-builder/?branch=2.x)\n[![Codecov](https://codecov.io/gh/cycle/schema-builder/graph/badge.svg)](https://codecov.io/gh/cycle/schema-builder)\n\nSchema Builder package provides a convenient way to configure your ORM and Database schema via \n[annotations (attributes)](https://github.com/cycle/annotated) or custom generators.\n\n## Installation\n\n```bash\ncomposer require cycle/schema-builder\n```\n\n## Configuration\n\n```php\nuse Cycle\\Migrations;\nuse Cycle\\Database;\nuse Cycle\\Database\\Config;\n\n$dbal = new Database\\DatabaseManager(new Config\\DatabaseConfig([\n    'default' =\u003e 'default',\n    'databases' =\u003e [\n        'default' =\u003e [\n            'connection' =\u003e 'sqlite'\n        ]\n    ],\n    'connections' =\u003e [\n        'sqlite' =\u003e new Config\\SQLiteDriverConfig(\n            connection: new Config\\SQLite\\MemoryConnectionConfig(),\n            queryCache: true,\n        ),\n    ]\n]));\n\n$registry = new \\Cycle\\Schema\\Registry($dbal);\n```\n\nWe can now register our first entity, add its columns and link to a specific table:\n\n```php\nuse Cycle\\Schema\\Definition;\n\n$entity = new Definition\\Entity();\n\n$entity\n    -\u003esetRole('user')\n    -\u003esetClass(User::class);\n\n// add fields\n$entity-\u003egetFields()\n    -\u003eset('id', (new Definition\\Field())-\u003esetType('primary')-\u003esetColumn('id')-\u003esetPrimary(true))\n    -\u003eset('name', (new Definition\\Field())-\u003esetType('string(32)')-\u003esetColumn('user_name'));\n\n// register entity\n$r-\u003eregister($entity);\n\n// associate table\n$r-\u003elinkTable($entity, 'default', 'users');\n```\nYou can generate ORM schema immediately using `Cycle\\Schema\\Compiler`:\n\n```php\nuse Cycle\\Schema\\Compiler;\n$schema = (new Compiler())-\u003ecompile($r);\n\n$orm = $orm-\u003ewith(schema: new \\Cycle\\ORM\\Schema($schema));\n```\n\nYou can find more information about Schema builder package [here](https://cycle-orm.dev/docs/advanced-schema-builder).\n\nLicense:\n--------\nThe MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained\nby [Spiral Scout](https://spiralscout.com).\n\n","funding_links":["https://github.com/sponsors/cycle"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Fschema-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycle%2Fschema-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Fschema-builder/lists"}