PHPackages                             rapids/rapids - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rapids/rapids

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rapids/rapids
=============

Package Laravel de génération de modèles et relations

v2.1.0(1y ago)101002MITPHPPHP ^8.2|^8.3|^8.4

Since Apr 19Pushed 1y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (5)Versions (5)Used By (0)

RapidsModels
============

[](#rapidsmodels)

[![Latest Version on Packagist](https://camo.githubusercontent.com/089c90a60e70200e81d28b70334317ef340bd44f1d77c209869c08b66b60e8b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7261706964732f7261706964732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rapids/rapids)[![Total Downloads](https://camo.githubusercontent.com/d14ddc69455057d4ec91ede41fd5865da6f255810e3caa009897f557dd10b789/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7261706964732f7261706964732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rapids/rapids)[![GitHub Sponsors](https://camo.githubusercontent.com/2bba0bfbd8663600897617018bc4c5991176cbf63e67982068bc061a4720d0ff/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73706f6e736f72732f547265736f722d4b6173656e64613f7374796c653d736f6369616c)](https://x.com/TresorKasenda)[![GitHub Issues](https://camo.githubusercontent.com/45cc95f1c8d62ec38806dfbc76e472d385bb55a52e7a357db8ad29443e2da51b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f547265736f722d4b6173656e64612f7261706964732d6d6f64656c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rapids/rapids)

> **Supercharge your Laravel development workflow by generating complete model ecosystems with a single command**

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

[](#-table-of-contents)

- [Introduction](#introduction)
- [Installation](#installation)
- [Core Features](#core-features)
- [Basic Usage](#basic-usage)
- [Field Types](#field-types)
- [Relationship Management](#relationship-management)
    - [Belongs To Relationship](#1-belongs-to-relationship)
    - [Has One Relationship](#2-has-one-relationship)
    - [Has Many Relationship](#3-has-many-relationship)
    - [Belongs To Many Relationship](#4-belongs-to-many-relationship)
    - [Has One Through Relationship](#5-has-one-through-relationship)
    - [Has Many Through Relationship](#6-has-many-through-relationship)
    - [Polymorphic Relationships](#7-polymorphic-relationships)
- [Working with Existing Models](#working-with-existing-models)
- [PHP Compatibility](#php-compatibility)
- [Contributing](#contributing)
- [Support](#support)
- [License](#license)

Introduction
------------

[](#introduction)

RapidsModels is a Laravel package designed to streamline your development workflow by automating the creation of the entire model ecosystem. Instead of manually creating models, migrations, factories, and seeders separately, RapidsModels handles everything with a single command and an intuitive interactive process.

**Why Use RapidsModels?**

- **Time Efficiency**: Create complete model ecosystems in seconds
- **Consistency**: Maintain standardized code across your project
- **Interactive Process**: Guided setup with clear prompts
- **Complete Solution**: Generates models, migrations, factories, seeders, and relationships
- **Full Laravel Relations Support**: Supports ALL Laravel relationship types (hasOne, belongsTo, hasMany, belongsToMany, hasOneThrough, hasManyThrough, morphOne, morphMany, morphTo, morphToMany, morphedByMany)
- **Modern PHP Support**: Compatible with PHP 8.2, 8.3, and 8.4
- **Flexible**: Works with new projects or existing codebases

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

[](#installation)

Installing RapidsModels is straightforward with Composer:

```
composer require rapids/rapids
```

Laravel will automatically discover the package - no additional configuration required.

Core Features
-------------

[](#core-features)

- **One-Command Generation**: Create models, migrations, factories, and seeders with a single command
- **Interactive Setup**: Guided creation process for fields and relationships
- **Comprehensive Field Support**: Supports all Laravel field types with appropriate options
- **Automated Relationships**: Configures both sides of model relationships
- **Complete Relations Support**: All Laravel relationships including through and polymorphic relations
- **Pivot Table Support**: Handles many-to-many relationships with customizable pivot tables
- **Existing Model Integration**: Works with existing models to add fields or relationships
- **Migration Generation**: Creates migrations for new models or updates to existing ones
- **Modern PHP Support**: Takes advantage of PHP 8.2+ features like readonly classes

Basic Usage
-----------

[](#basic-usage)

Generate a complete model ecosystem with a single command:

```
php artisan rapids:model Product
```

The interactive process will guide you through:

1. Adding fields with their types and options
2. Setting up foreign keys and relationships
3. Configuring timestamps, soft deletes, and other options
4. Creating factories and seeders

### Using Fields JSON Flag

[](#using-fields-json-flag)

You can also create a model with a single command by providing field definitions as a JSON string:

```
php artisan rapids:model User --fields='{"name":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"_config":{"softDeletes":true}}'
```

The JSON structure supports:

- Field definitions with type, nullable, default, length properties
- Relationship definitions with type, model, and inverse properties
- Configuration options like softDeletes

Example with relationships:

```
php artisan rapids:model Post --fields='{"title":{"type":"string"},"content":{"type":"text"},"category":{"relation":{"type":"belongsTo","model":"Category","inverse":"hasMany"}},"_config":{"softDeletes":true}}'
```

### Traditional Approach vs RapidsModels

[](#traditional-approach-vs-rapidsmodels)

**Traditional Approach:**

```
- Create model:        php artisan make:model Product
- Create migration:    php artisan make:migration create_products_table
- Create factory:      php artisan make:factory ProductFactory
- Create seeder:       php artisan make:seeder ProductSeeder
- Define fields:       Manually edit migration file
- Configure relations: Manually edit model files

```

**RapidsModels Approach:**

```
- Everything at once:  php artisan rapids:model Product
                       (follow the interactive prompts)

```

Field Types
-----------

[](#field-types)

RapidsModels supports all standard Laravel field types:

TypeDescriptionExample Use CasesstringText dataname, title, slugtextLonger textcontent, description, biographyintegerWhole numberscount, position, agedecimalNumbers with decimalsprice, weight, ratingbooleanTrue/false valuesis\_active, has\_discountdateDate without timebirth\_date, release\_datedatetimeDate with timestarts\_at, expires\_atenumPredefined optionsstatus, role, typejsonJSON datasettings, preferences, metadatauuidUUID identifiersuuid field with HasUuids traitRelationship Management
-----------------------

[](#relationship-management)

RapidsModels simplifies creating and managing relationships between models.

### 1. Belongs To Relationship

[](#1-belongs-to-relationship)

**Example: Product belongs to Category**

```
> Enter field name: category_id
> Enter field type: integer
> Is this a foreign key? Yes
> Enter related model name: Category
> Select relationship type: belongsTo
> Select inverse relationship type: hasMany
```

**Generated Code:**

```
// In Product.php
public function category(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
    return $this->belongsTo(Category::class);
}

// In Category.php
public function products(): \Illuminate\Database\Eloquent\Relations\HasMany
{
    return $this->hasMany(Product::class);
}
```

### 2. Has One Relationship

[](#2-has-one-relationship)

**Example: User has one Profile**

```
> Enter field name: user_id
> Enter field type: integer
> Is this a foreign key? Yes
> Enter related model name: User
> Select relationship type: belongsTo
> Select inverse relationship type: hasOne
```

**Generated Code:**

```
// In Profile.php
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
    return $this->belongsTo(User::class);
}

// In User.php
public function profile(): \Illuminate\Database\Eloquent\Relations\HasOne
{
    return $this->hasOne(Profile::class);
}
```

### 3. Has Many Relationship

[](#3-has-many-relationship)

**Example: Author has many Books**

```
> Enter field name: author_id
> Enter field type: integer
> Is this a foreign key? Yes
> Enter related model name: Author
> Select relationship type: belongsTo
> Select inverse relationship type: hasMany
```

**Generated Code:**

```
// In Book.php
public function author(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
    return $this->belongsTo(Author::class);
}

// In Author.php
public function books(): \Illuminate\Database\Eloquent\Relations\HasMany
{
    return $this->hasMany(Book::class);
}
```

### 4. Belongs To Many Relationship

[](#4-belongs-to-many-relationship)

**Example: Post has many Tags (and vice versa)**

```
> Add relationship? Yes
> Enter related model name: Tag
> Select relationship type: belongsToMany
> Customize pivot table name? No
> Add timestamps to pivot? Yes
```

**Generated Code:**

```
// In Post.php
public function tags(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
    return $this->belongsToMany(Tag::class)
        ->withTimestamps();
}

// In Tag.php
public function posts(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
    return $this->belongsToMany(Post::class)
        ->withTimestamps();
}
```

### 5. Has One Through Relationship

[](#5-has-one-through-relationship)

**Example: Supplier has one Account through User**

```
> Add relationship? Yes
> Select relationship type: hasOneThrough
> Enter related model name: Account
> Enter intermediate model name: User
> Enter foreign key on intermediate model: supplier_id
> Enter foreign key on target model: user_id
```

**Generated Code:**

```
// In Supplier.php
public function account(): \Illuminate\Database\Eloquent\Relations\HasOneThrough
{
    return $this->hasOneThrough(
        Account::class,
        User::class,
        'supplier_id', // Foreign key on User table...
        'user_id',     // Foreign key on Account table...
        'id',          // Local key on Supplier table...
        'id'           // Local key on User table...
    );
}
```

### 6. Has Many Through Relationship

[](#6-has-many-through-relationship)

**Example: Country has many Patients through Hospitals**

```
> Add relationship? Yes
> Select relationship type: hasManyThrough
> Enter related model name: Patient
> Enter intermediate model name: Hospital
> Enter foreign key on intermediate model: country_id
> Enter foreign key on target model: hospital_id
```

**Generated Code:**

```
// In Country.php
public function patients(): \Illuminate\Database\Eloquent\Relations\HasManyThrough
{
    return $this->hasManyThrough(
        Patient::class,
        Hospital::class,
        'country_id',  // Foreign key on Hospital table...
        'hospital_id', // Foreign key on Patient table...
        'id',          // Local key on Country table...
        'id'           // Local key on Hospital table...
    );
}
```

### 7. Polymorphic Relationships

[](#7-polymorphic-relationships)

**Example: Image morphTo multiple models (Post, User)**

```
> Enter field name: imageable_id
> Enter field name: imageable_type
> Select relationship type: morphTo
> Enter polymorphic name: imageable
```

**Generated Code:**

```
// In Image.php
public function imageable(): \Illuminate\Database\Eloquent\Relations\MorphTo
{
    return $this->morphTo();
}

// In Post.php (when creating the Post model)
public function image(): \Illuminate\Database\Eloquent\Relations\MorphOne
{
    return $this->morphOne(Image::class, 'imageable');
}

// In User.php (when creating the User model)
public function image(): \Illuminate\Database\Eloquent\Relations\MorphOne
{
    return $this->morphOne(Image::class, 'imageable');
}
```

Working with Existing Models
----------------------------

[](#working-with-existing-models)

RapidsModels integrates seamlessly with existing Laravel projects:

### Adding Fields to Existing Models

[](#adding-fields-to-existing-models)

When running `rapids:model` on an existing model name:

```
php artisan rapids:model Product
```

The system will detect the existing model and offer options:

1. **Add a new migration for the existing model**: Create a migration to add fields to an existing table
2. **Update the existing model file**: Add relationships or methods to the model class
3. **Generate additional components**: Create missing factory or seeder files

### Example: Adding a Relationship to an Existing Model

[](#example-adding-a-relationship-to-an-existing-model)

```
php artisan rapids:model Product
> Model Product already exists.
> What would you like to do? Update existing model file
> Add relationship? Yes
> Enter related model name: Supplier
> Select relationship type: belongsTo
> Create migration for foreign key? Yes
```

This will:

1. Create a migration to add the supplier\_id field
2. Add the relationship method to your Product model
3. Add the inverse relationship method to your Supplier model

PHP Compatibility
-----------------

[](#php-compatibility)

RapidsModels is compatible with:

- PHP 8.2
- PHP 8.3
- PHP 8.4

The package takes advantage of modern PHP features including:

- Readonly classes and properties
- Constructor property promotion
- Match expressions
- Return type declarations
- Named arguments

Contributing
------------

[](#contributing)

Contributions are welcome! Here's how you can help:

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/amazing-feature`
3. Commit your changes: `git commit -m 'Add some amazing feature'`
4. Push to the branch: `git push origin feature/amazing-feature`
5. Open a Pull Request

### Development Setup

[](#development-setup)

```
# Clone the repository
git clone https://github.com/Tresor-Kasenda/rapids-models.git

# Install dependencies
composer install

# Run tests
./vendor/bin/phpunit
```

Support
-------

[](#support)

If you find RapidsModels useful in your projects, consider supporting development:

- **Star the repository** on GitHub
- **Share your experience** on social media using #RapidsModels
- **Donate** via [GitHub Sponsors](https://github.com/sponsors/Tresor-Kasenda)
- **Hire me** for your Laravel projects

License
-------

[](#license)

RapidsModels is open-source software licensed under the [MIT license](LICENSE.md).

---

Made with ❤️ by [Tresor Kasenda](https://github.com/Tresor-Kasenda)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance48

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

4

Last Release

379d ago

Major Versions

v1.0.2 → v2.1.02025-05-04

PHP version history (2 changes)v1.0.0PHP ^8.3

v1.0.2PHP ^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c1881faab5151123abdf9072ab481111c6150115b610dd0f6f34c0d3f66db43?d=identicon)[Scott-Tresor](/maintainers/Scott-Tresor)

---

Top Contributors

[![Tresor-Kasenda](https://avatars.githubusercontent.com/u/34010260?v=4)](https://github.com/Tresor-Kasenda "Tresor-Kasenda (20 commits)")

---

Tags

laravelgeneratormodelsrelations

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rapids-rapids/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[livewire/flux

The official UI component library for Livewire.

9475.0M86](/packages/livewire-flux)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[dcblogdev/laravel-module-generator

Generate Laravel Modules from a template.

7710.1k1](/packages/dcblogdev-laravel-module-generator)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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