PHPackages                             saloum45/controllergenerate - 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. [Framework](/categories/framework)
4. /
5. saloum45/controllergenerate

ActiveLibrary[Framework](/categories/framework)

saloum45/controllergenerate
===========================

😊Un package Laravel qui facilite la génération dynamique de contrôleurs,migrations et de routes dans une application Laravel. a Laravel package that makes it easy to dynamically generate controllers, migrations and routes in a Laravel application.😊

v3.1.1(1mo ago)4220↓88.9%1MITPHPPHP &gt;=7.2

Since Oct 30Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/saloum45/controllergenerate)[ Packagist](https://packagist.org/packages/saloum45/controllergenerate)[ RSS](/packages/saloum45-controllergenerate/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (57)Used By (0)

ControllerGenerate Laravel
==========================

[](#controllergenerate-laravel)

Saloum45/ControllerGenerate est un package Laravel qui facilite la génération dynamique de contrôleurs, migrations, routes et relations dans une application Laravel(API).

#### Tuto complet :

[](#tuto-complet-)

[![youtube](https://camo.githubusercontent.com/1d37f256cfcf28ec8cb4b75471980ac13236fcd31bdb1be49e8a1c88532316e0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f796f75747562652d4646303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d796f7574756265266c6f676f436f6c6f723d7768697465)](https://www.youtube.com/watch?v=YJmBQQF3ODU)

---

Comment ça marche 👉🏽😇
---------------------

[](#comment-ça-marche-)

1. Il faut d’abord **créer les modèles**.

    - Respectez le **PascalCase** pour le nom des modèles, ex : `EtudiantClasse`.
    - Le package se base sur les modèles pour générer les contrôleurs, migrations, routes et relations.
2. Pour les **clés étrangères**, respectez cette nomenclature :

    - `id_nom_de_table`, exemple : `id_classe`.

---

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

[](#installation)

Ajoutez le package à votre projet Laravel via Composer :

```
composer require saloum45/controllergenerate
```

**Configuration** :
Une fois installé package crée automatiquement les commandes nécessaires, que vous pouvez exécuter en suivant ces étapes.

---

Commandes disponibles
---------------------

[](#commandes-disponibles)

### 1️⃣ Générer les contrôleurs

[](#1️⃣-générer-les-contrôleurs)

```
php artisan generate:controllers
```

- Crée des contrôleurs pour tous les modèles.

```
php artisan generate:controllers NomModel
```

- Crée le contrôleur pour un modèle spécifique.
- #### Chaque contrôleur contient des **méthodes CRUD**, un endpoint `getFormDetails` pour les clés étrangères, et les méthodes `login`/`logout` pour le modèle `User`.

    [](#chaque-contrôleur-contient-des-méthodes-crud-un-endpoint-getformdetails-pour-les-clés-étrangères-et-les-méthodes-loginlogout-pour-le-modèle-user)

---

### 2️⃣ Générer les routes

[](#2️⃣-générer-les-routes)

```
php artisan generate:routes
```

- Crée des routes API pour tous les contrôleurs.

```
php artisan generate:routes NomModel
```

- Crée des routes API pour un contrôleur spécifique.
- #### Si un fichier de routes existe, les nouvelles routes sont ajoutées **à la fin** sans écraser le fichier existant.

    [](#si-un-fichier-de-routes-existe-les-nouvelles-routes-sont-ajoutées-à-la-fin-sans-écraser-le-fichier-existant)

---

### 3️⃣ Générer les migrations

[](#3️⃣-générer-les-migrations)

```
php artisan generate:migrations
```

- Crée les migrations à partir des attributs `$fillable` des modèles.

```
php artisan generate:migrations NomModel
```

- Crée la migration d'un modèle spécifique.
- #### Les migrations sont générées dans le bon ordre en fonction des **dépendances des clés étrangères**. Si une migration existe déjà pour un modèle, elle **est écrasée** pour éviter les duplications.

    [](#les-migrations-sont-générées-dans-le-bon-ordre-en-fonction-des-dépendances-des-clés-étrangères-si-une-migration-existe-déjà-pour-un-modèle-elle-est-écrasée-pour-éviter-les-duplications)

---

### 4️⃣ Générer les relations (belongsTo et hasMany) entre modèles

[](#4️⃣-générer-les-relations-belongsto-et-hasmany-entre-modèles)

```
php artisan generate:relations
```

- Crée les relations de tous les modéles.

```
php artisan generate:relations NomModel
```

- Crée les relations pour un modèle spécifique.

---

### 5️⃣ Commande ultime : tout générer

[](#5️⃣-commande-ultime--tout-générer)

```
php artisan generate:all
```

- Regroupe toutes les commandes ci-dessus en une seule pour tous les modèles.

```
php artisan generate:all NomModel
```

- Regroupe toutes les commandes ci-dessus en une seule pour un modèle spécifique.

---

### 6️⃣ Exécuter les migrations

[](#6️⃣-exécuter-les-migrations)

```
php artisan migrate
```

---

Résultat attendu
----------------

[](#résultat-attendu)

- **Controllers** : créés dans `app/Http/Controllers` avec méthodes CRUD.
- **Migrations** : créées dans `database/migrations` dans le bon ordre avec clés étrangères.
- **Routes** : ajoutées à `routes/api.php`.
- **Relations** : ajoutées automatiquement dans les modèles (belongsTo et hasMany).
- Bonus : gestion spéciale pour le modèle `User` avec endpoints `login`/`logout` avec géneration du token.

---

Bon code 🧑🏽‍💻 Salem DEV 👈🏽 fait avec beaucoup de ❤️ et ☕️
---------------------------------------------------------

[](#bon-code-‍-salem-dev--fait-avec-beaucoup-de-️-et-️)

---

ControllerGenerate Laravel
==========================

[](#controllergenerate-laravel-1)

**Saloum45/ControllerGenerate** is a Laravel package that makes it easy to dynamically generate **controllers**, **migrations**, **routes**, and **relations** in a Laravel (API) application.

#### Full tutorial:

[](#full-tutorial)

[![youtube](https://camo.githubusercontent.com/1d37f256cfcf28ec8cb4b75471980ac13236fcd31bdb1be49e8a1c88532316e0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f796f75747562652d4646303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d796f7574756265266c6f676f436f6c6f723d7768697465)](https://www.youtube.com/watch?v=YJmBQQF3ODU)

---

How it works 👉🏽😇
----------------

[](#how-it-works-)

1. You must first **create the models**.

    - Use **PascalCase** for model names, e.g., `StudentClass`.
    - The package relies on models to generate controllers, migrations, routes, and relations.
2. For **foreign keys**, follow this naming convention:

    - `id_table_name`, e.g., `id_class`.

---

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

[](#installation-1)

Add the package to your Laravel project via Composer:

```
composer require saloum45/controllergenerate
```

**Configuration**:
Once installed, the package automatically registers the necessary commands, which you can execute as shown below.

---

Available Commands
------------------

[](#available-commands)

### 1️⃣ Generate controllers

[](#1️⃣-generate-controllers)

```
php artisan generate:controllers
```

- Creates controllers for all models.

```
php artisan generate:controllers ModelName
```

- Creates a controller for a specific model.
- #### Each controller contains **CRUD methods**, a `getFormDetails` endpoint for foreign keys, and `login`/`logout` methods for the `User` model.

    [](#each-controller-contains-crud-methods-a-getformdetails-endpoint-for-foreign-keys-and-loginlogout-methods-for-the-user-model)

---

### 2️⃣ Generate routes

[](#2️⃣-generate-routes)

```
php artisan generate:routes
```

- Creates API routes for all controllers.

```
php artisan generate:routes ModelName
```

- Creates API routes for a specific controller.
- #### If a routes file already exists, the new routes are **added at the end** without overwriting the existing file.

    [](#if-a-routes-file-already-exists-the-new-routes-are-added-at-the-end-without-overwriting-the-existing-file)

---

### 3️⃣ Generate migrations

[](#3️⃣-generate-migrations)

```
php artisan generate:migrations
```

- Creates migrations based on the `$fillable` attributes of models.

```
php artisan generate:migrations ModelName
```

- Creates the migration for a specific model.
- #### Migrations are generated in the correct order based on **foreign key dependencies**. If a migration already exists for a model, it is **overwritten** to avoid duplicates.

    [](#migrations-are-generated-in-the-correct-order-based-on-foreign-key-dependencies-if-a-migration-already-exists-for-a-model-it-is-overwritten-to-avoid-duplicates)

---

### 4️⃣ Generate model relations (belongsTo and hasMany)

[](#4️⃣-generate-model-relations-belongsto-and-hasmany)

```
php artisan generate:relations
```

- Creates relations for all models.

```
php artisan generate:relations ModelName
```

- Creates relations for a specific model.

---

### 5️⃣ Ultimate command: generate everything

[](#5️⃣-ultimate-command-generate-everything)

```
php artisan generate:all
```

- Runs all of the above commands for all models.

```
php artisan generate:all ModelName
```

- Runs all of the above commands for a specific model.

---

### 6️⃣ Run migrations

[](#6️⃣-run-migrations)

```
php artisan migrate
```

---

Expected result
---------------

[](#expected-result)

- **Controllers**: created in `app/Http/Controllers` with CRUD methods.
- **Migrations**: created in `database/migrations` in the correct order with foreign keys.
- **Routes**: added to `routes/api.php`.
- **Relations**: automatically added to models (belongsTo and hasMany).
- Bonus: special handling for the `User` model with `login`/`logout` endpoints and token generation.

---

Happy coding 🧑🏽‍💻 Salem DEV 👈🏽 done with a lot of ❤️ and ☕️
-----------------------------------------------------------

[](#happy-coding-‍-salem-dev--done-with-a-lot-of-️-and-️)

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance92

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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 ~11 days

Recently: every ~26 days

Total

54

Last Release

41d ago

Major Versions

v1.1.4 → v2.0.02024-10-30

v2.3.8 → v3.0.02025-09-30

PHP version history (2 changes)v1.1.1PHP ^7.4|^8.0

v2.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/78548052?v=4)[Mouhamadou Fall Bah](/maintainers/mouhamadoufallBah)[@mouhamadoufallBah](https://github.com/mouhamadoufallBah)

![](https://www.gravatar.com/avatar/0b0a8e2fb6242a98a451c150e295d5561b1be5ab95ad1f9862358d99b7fdc0cb?d=identicon)[saloum45](/maintainers/saloum45)

---

Top Contributors

[![saloum45](https://avatars.githubusercontent.com/u/64892800?v=4)](https://github.com/saloum45 "saloum45 (100 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k91.3M280](/packages/laravel-horizon)[laravel/sail

Docker files for running a basic Laravel application.

1.9k199.2M1.2k](/packages/laravel-sail)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76518.2M120](/packages/laravel-mcp)[illuminate/routing

The Illuminate Routing package.

1239.0M2.8k](/packages/illuminate-routing)[laravel/surveyor

Static analysis tool for Laravel applications.

8690.3k12](/packages/laravel-surveyor)

PHPackages © 2026

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