PHPackages                             nova-horizons/realoquent - 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. nova-horizons/realoquent

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

nova-horizons/realoquent
========================

v0.9.0(1y ago)522.5k↓28.8%[11 PRs](https://github.com/nova-horizons/realoquent/pulls)MITPHPPHP ~8.2|~8.3|~8.4CI failing

Since Oct 2Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/nova-horizons/realoquent)[ Packagist](https://packagist.org/packages/nova-horizons/realoquent)[ RSS](/packages/nova-horizons-realoquent/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (32)Used By (0)

 ⚠️ This is pre-beta and no longer maintained.
 Realoquent: Laravel Schema and Model Generator
Less Magic, More Generated Code
===============================================================================================================================

[](#----️-this-is-pre-beta-and-no-longer-maintained----realoquent-laravel-schema-and-model-generatorless-magic-more-generated-code)

 [![Latest Version on Packagist](https://camo.githubusercontent.com/9bf793948d2ba5553ab83a08508be4abc5a0313a74023fd03856d24d72ab30b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f76612d686f72697a6f6e732f7265616c6f7175656e742e737667)](https://packagist.org/packages/nova-horizons/realoquent) [![tests](https://github.com/nova-horizons/realoquent/actions/workflows/tests.yml/badge.svg)](https://github.com/nova-horizons/realoquent/actions/workflows/tests.yml) [![static analysis](https://github.com/nova-horizons/realoquent/actions/workflows/static-analysis.yml/badge.svg)](https://github.com/nova-horizons/realoquent/actions/workflows/static-analysis.yml) [![code coverage](https://camo.githubusercontent.com/4b626be81b090ee878f49b39cc450532198603451c6c3ab84c21070845ab7edb/68747470733a2f2f636f6465636f762e696f2f67682f6e6f76612d686f72697a6f6e732f7265616c6f7175656e742f67726170682f62616467652e7376673f746f6b656e3d464649545a4b4d364d32)](https://codecov.io/gh/nova-horizons/realoquent) [![MIT Licensed](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)

In a Laravel application, making a database-related change can be a bit complicated... Create a migration, create a model, fill out fillable/guarded, fill out casts, write validation, add relationship methods... What if it could all be done automatically?

Realoquent defines your database and model structure in a single PHP file. Make an update to this PHP schema file and run a command and it will all be done for you:

- Generate and run a migration
- Generate or update the model class, populating:
    - Relationship methods
    - PHPDocs for model properties
    - `$fillable`
    - `$guarded`
    - `$cast`
    - Primary key name/type
- Generate base model class to separate this configuration from your model code
- Generate validation rules for your models
- Generate groups of validation rules for different scenarios (create, edit, etc.)

Realoquent is inspired by many of the functions of [Propel ORM](https://propelorm.org), like a single schema file as source of truth, and generated base model classes with user-editable model classes. Generated code is as strongly typed as possible, and uses type hints as a fallback (all generated code passes PHPStan Level 9). This provides a better experience in your IDE and static analysis tools without requiring additional plugins or packages.

Table of Contents
-----------------

[](#table-of-contents)

- [Example `schema.php`](#example-schemaphp)
- [Setup](#setup)
- [Usage](#usage)
- [FAQ](#faq)
- [Todo](#todo)
- [Development Setup](#development-setup)

Example `schema.php`
--------------------

[](#example-schemaphp)

Here's an example `schema.php` file for a basic Users table

```
return [
    'users' => [
        'model' => \App\Models\User::class,
        'columns' => [
            'id' => [
                'type' => ColumnType::id,
                'guarded' => true,
                'primary' => true,
            ],
            'team_id' => [
                'type' => RelationshipType::belongsTo,
                'relatedModel' => \App\Models\Team::class,
            ],
            'username' => [
                'type' => ColumnType::string,
                'fillable' => true,
                'unique' => true,
                'validation' => 'required|string|max:255',
                'validationGroups' => ['create']
            ],
            'birthdate' => [
                'type' => ColumnType::date,
                'fillable' => true,
                'nullable' => true,
                'validation' => 'date',
                'validationGroups' => ['create', 'edit']
            ],
            'role' => [
                'type' => ColumnType::string,
                'fillable' => false,
                'default' => User::DEFAULT_ROLE,
                'index' => true,
            ],
        ],
    ],
];
```

Setup
-----

[](#setup)

After installing and configuring Realoquent, it will generate your `schema.php` file based off your existing database schema and Eloquent models.

See [Setup](docs/setup.md) documentation for details on how to get started.

Usage
-----

[](#usage)

To make a change to your database schema or models, update the item in your `schema.php` file.

Then run `php artisan realoquent:diff` to review the changes, generate the migration, and update your models.

For more details, see the documentation:

- [Setup](docs/setup.md)
- [Usage](docs/usage.md)
- [Compatibility](docs/compatibility.md)
- Schema Management
    - [Tables](docs/schema-management/tables.md)
    - [Columns](docs/schema-management/columns.md)
    - [Indexes](docs/schema-management/indexes.md)
- Eloquent &amp; Laravel
    - [Models Overview](docs/eloquent/models.md)
    - [Relationships](docs/eloquent/relationships.md)
    - [Validation](docs/eloquent/validation.md)
- Commands
    - [diff](docs/commands/diff.md)
    - [generate-models](docs/commands/generate-models.md)
    - [generate-schema](docs/commands/generate-schema.md)

FAQ
---

[](#faq)

### How does Realoquent compare to other Laravel schema/model generators?

[](#how-does-realoquent-compare-to-other-laravel-schemamodel-generators)

Realoquent is designed to have a schema file as the source of truth. It lives with your project, and is not only for initial project scaffolding or setup. It allows for changes and code generation at any point without compromising your custom logic. This package focuses only on databases and models, leaving other aspects like controllers or forms up to your teams preference. Realoquent specializes in handling the routine, repetitive tasks such as migrations and model configurations, leaving the details of logic or preferred controller/form patterns to you.

### Why use a PHP file to define the schema, instead of Model properties or annotations?

[](#why-use-a-php-file-to-define-the-schema-instead-of-model-properties-or-annotations)

Using a separate PHP file to define the schema, as opposed to Model properties or annotations, provides for several benefits:

- It provides a cohesive, scannable overview of your entire schema, making it easier to comprehend and manage.
- It ensures that Realoquent operates separately from your production system. By generating standard Laravel code, you keep the confidence in
    Laravel's framework code. You don't need to worry about Realoquent doing anything suspicious. At any point you can remove Realoquent and all your code will still work, since it generates plain Laravel migrations and plain Eloquent models.
- Using PHP instead of YAML/etc also allows you to reference constants, classes or even call functions to define your schema.
- It allows for a separation between the database schema and the models. This means that you can have tables in your database that do not necessarily have corresponding models in your code. By moving the schema to a configuration file, it ensures that your code files are reserved exclusively for your actual application logic. This improves the overall organization and readability of your codebase.

### Why generate a base model class?

[](#why-generate-a-base-model-class)

Generating a base model class helps improve your code organization and promote cleaner models. The base model class contains the auto-generated code such as fillable, guarded, casts properties, validation, and PHPDocs for model properties. The main model file then stays small &amp; tidy, containing only your custom logic. This also ensures that auto-generated code and custom code are kept separate, reducing the chance of accidental changes and making future updates simpler and less error-prone.

### Why does everything in schema.php have a realoquentId?

[](#why-does-everything-in-schemaphp-have-a-realoquentid)

Each item in schema.php having a realoquentId serves as a unique identifier. This unique identifier is used to track the schema changes over time. When you run the realoquent:diff command, it compares these IDs to identify which parts have been added, removed, or changed. Specifically this helps with detecting when a column/table/index is renamed, without requiring any extra work or different behavior to rename an item. This detailed tracking allows for the precise generation of migration files reflecting exactly what has been modified in your schema.

Todo
----

[](#todo)

Realoquent is still in progress. Here's some of the things that need to be done:

- Create Snapshot on project setup
- Add support for relationships/foreign keys
- Preserve ordering of new columns and generate correct `after()` in migration
- Support for validation functions like `Rules\Password::defaults()`
- Generate other validation helper methods, like `validateAndCreate` or `validateAndFill`
- Support for Expressions in column defaults `default(new Expression('(JSON_ARRAY())'))`
- Support for `spatialIndex`
- Support for `$column->hidden/visible`
- Support for `$table->with/withCount/preventsLazyLoading`
- Support for `$table->engine/collation/charset`
- Support for `$column->collation/charset/useCurrent/useCurrentOnUpdate`
- Support for `vector` and `macAddress` types
- Support for route binding configuration
- Generate `down` migrations
- Generate other things (Model Factories, Nova Resources, Form Requests, other form builders?)
- Detected any installed code-style tool and automatically set `cs_fixer_command`

Development Setup
-----------------

[](#development-setup)

If you want to contribute changes to Realoquent:

1. Clone this repo
2. Run `composer install`
3. Run `./vendor/bin/sail up -d` to start test databases
4. Make your changes
5. Run `composer quality` to run CS Fixer, Pest, and PHPStan

To include in another project, add the following to your `composer.json` file, then follow normal setup:

```
"repositories": [
    {
    "type": "path",
    "url": "/path/to/your/realoquent"
    }
]
```

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance63

Regular maintenance activity

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 65.8% 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 ~27 days

Recently: every ~53 days

Total

20

Last Release

447d ago

PHP version history (2 changes)v0.1.0PHP ~8.1|~8.2|~8.3

v0.8.0PHP ~8.2|~8.3|~8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a96933403bfe8ae103a42c6cece2b4342eb597ed4d753c8cc10c6e674e43f71?d=identicon)[pb30](/maintainers/pb30)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (202 commits)")[![pb30](https://avatars.githubusercontent.com/u/259602?v=4)](https://github.com/pb30 "pb30 (105 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nova-horizons-realoquent/health.svg)

```
[![Health](https://phpackages.com/badges/nova-horizons-realoquent/health.svg)](https://phpackages.com/packages/nova-horizons-realoquent)
```

###  Alternatives

[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[aglipanci/laravel-eloquent-case

Adds CASE statement support to Laravel Query Builder.

115157.2k](/packages/aglipanci-laravel-eloquent-case)

PHPackages © 2026

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