PHPackages                             cycle/schema-builder - 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-builder

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

cycle/schema-builder
====================

Cycle ORM Schema Builder

v2.11.2(10mo ago)15758.7k—7.6%13[4 PRs](https://github.com/cycle/schema-builder/pulls)18MITPHPPHP &gt;=8.0CI passing

Since Mar 26Pushed 10mo ago6 watchersCompare

[ Source](https://github.com/cycle/schema-builder)[ Packagist](https://packagist.org/packages/cycle/schema-builder)[ GitHub Sponsors](https://github.com/sponsors/cycle)[ RSS](/packages/cycle-schema-builder/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (49)Used By (18)

Cycle ORM - Schema Builder
==========================

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

[![Latest Stable Version](https://camo.githubusercontent.com/83cc614a1ba63c26bf8e3e98781f302779981ea624237c405c01aafdd19b7065/68747470733a2f2f706f7365722e707567782e6f72672f6379636c652f736368656d612d6275696c6465722f76657273696f6e)](https://packagist.org/packages/cycle/schema-builder)[![Build Status](https://github.com/cycle/schema-builder/workflows/build/badge.svg)](https://github.com/cycle/schema-builder/actions)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5ae51450ef0a62ffe41ac052815286ad39c9c3800d92062ce92add4297c96f85/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6379636c652f736368656d612d6275696c6465722f6261646765732f7175616c6974792d73636f72652e706e673f623d322e78)](https://scrutinizer-ci.com/g/cycle/schema-builder/?branch=2.x)[![Codecov](https://camo.githubusercontent.com/9252187786facac4a204e7452cf42c87225f38838477b8f26ea986a10358050f/68747470733a2f2f636f6465636f762e696f2f67682f6379636c652f736368656d612d6275696c6465722f67726170682f62616467652e737667)](https://codecov.io/gh/cycle/schema-builder)

Schema Builder package provides a convenient way to configure your ORM and Database schema via [annotations (attributes)](https://github.com/cycle/annotated) or custom generators.

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

[](#installation)

```
composer require cycle/schema-builder
```

Configuration
-------------

[](#configuration)

```
use Cycle\Migrations;
use Cycle\Database;
use Cycle\Database\Config;

$dbal = new Database\DatabaseManager(new Config\DatabaseConfig([
    'default' => 'default',
    'databases' => [
        'default' => [
            'connection' => 'sqlite'
        ]
    ],
    'connections' => [
        'sqlite' => new Config\SQLiteDriverConfig(
            connection: new Config\SQLite\MemoryConnectionConfig(),
            queryCache: true,
        ),
    ]
]));

$registry = new \Cycle\Schema\Registry($dbal);
```

We can now register our first entity, add its columns and link to a specific table:

```
use Cycle\Schema\Definition;

$entity = new Definition\Entity();

$entity
    ->setRole('user')
    ->setClass(User::class);

// add fields
$entity->getFields()
    ->set('id', (new Definition\Field())->setType('primary')->setColumn('id')->setPrimary(true))
    ->set('name', (new Definition\Field())->setType('string(32)')->setColumn('user_name'));

// register entity
$r->register($entity);

// associate table
$r->linkTable($entity, 'default', 'users');
```

You can generate ORM schema immediately using `Cycle\Schema\Compiler`:

```
use Cycle\Schema\Compiler;
$schema = (new Compiler())->compile($r);

$orm = $orm->with(schema: new \Cycle\ORM\Schema($schema));
```

You can find more information about Schema builder package [here](https://cycle-orm.dev/docs/schema-dynamic-schema#using-schema-builder).

License:
--------

[](#license)

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

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance54

Moderate activity, may be stable

Popularity49

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 55.4% 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 ~47 days

Recently: every ~65 days

Total

49

Last Release

312d ago

Major Versions

v0.1 → v1.0.02019-03-29

v1.2.0 → v2.0.02021-12-22

1.x-dev → v2.2.02022-12-27

PHP version history (4 changes)v0.1PHP ^7.1|^8.0

v1.1.0PHP ^7.2

v1.1.20PHP &gt;=7.2

v2.0.0PHP &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![wolfy-j](https://avatars.githubusercontent.com/u/796136?v=4)](https://github.com/wolfy-j "wolfy-j (175 commits)")[![roxblnfk](https://avatars.githubusercontent.com/u/4152481?v=4)](https://github.com/roxblnfk "roxblnfk (54 commits)")[![msmakouz](https://avatars.githubusercontent.com/u/67324318?v=4)](https://github.com/msmakouz "msmakouz (35 commits)")[![butschster](https://avatars.githubusercontent.com/u/773481?v=4)](https://github.com/butschster "butschster (13 commits)")[![puzzledpolymath](https://avatars.githubusercontent.com/u/162779269?v=4)](https://github.com/puzzledpolymath "puzzledpolymath (9 commits)")[![gam6itko](https://avatars.githubusercontent.com/u/3841197?v=4)](https://github.com/gam6itko "gam6itko (7 commits)")[![rauanmayemir](https://avatars.githubusercontent.com/u/9691?v=4)](https://github.com/rauanmayemir "rauanmayemir (5 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (4 commits)")[![thenotsoft](https://avatars.githubusercontent.com/u/44147615?v=4)](https://github.com/thenotsoft "thenotsoft (4 commits)")[![SerafimArts](https://avatars.githubusercontent.com/u/2461257?v=4)](https://github.com/SerafimArts "SerafimArts (3 commits)")[![EvgenyBarinov](https://avatars.githubusercontent.com/u/65846823?v=4)](https://github.com/EvgenyBarinov "EvgenyBarinov (2 commits)")[![guilhermeaiolfi](https://avatars.githubusercontent.com/u/254360?v=4)](https://github.com/guilhermeaiolfi "guilhermeaiolfi (1 commits)")[![laxity7](https://avatars.githubusercontent.com/u/6792144?v=4)](https://github.com/laxity7 "laxity7 (1 commits)")[![mrakolice](https://avatars.githubusercontent.com/u/4227668?v=4)](https://github.com/mrakolice "mrakolice (1 commits)")[![alexndr-novikov](https://avatars.githubusercontent.com/u/7372962?v=4)](https://github.com/alexndr-novikov "alexndr-novikov (1 commits)")[![jstark518](https://avatars.githubusercontent.com/u/1571324?v=4)](https://github.com/jstark518 "jstark518 (1 commits)")

---

Tags

cycledatamapperhacktoberfestormphpschema

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[cycle/orm

PHP DataMapper ORM and Data Modelling Engine

1.3k835.4k65](/packages/cycle-orm)[cycle/annotated

Cycle ORM Annotated Entities generator

28724.2k44](/packages/cycle-annotated)[cycle/migrations

Database migrations, migration scaffolding

20539.5k29](/packages/cycle-migrations)[wayofdev/laravel-cycle-orm-adapter

🔥 A Laravel adapter for CycleORM, providing seamless integration of the Cycle DataMapper ORM for advanced database handling and object mapping in PHP applications.

3516.7k3](/packages/wayofdev-laravel-cycle-orm-adapter)[spiral/cycle-bridge

Cycle ORM integration package

18128.9k7](/packages/spiral-cycle-bridge)[cycle/active-record

Provides a simple way to work with your database using Active Record pattern and Cycle ORM

671.3k3](/packages/cycle-active-record)

PHPackages © 2026

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