PHPackages                             azwhosting/spark-crud-generator - 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. azwhosting/spark-crud-generator

ActiveLibrary

azwhosting/spark-crud-generator
===============================

🚀 Interactive CRUD generator for CodeIgniter 4 — multilingual, smart CLI prompts, safe overwrites, and full CRUD stack (model, entity, controller, views, migration).

v1.1.0(1y ago)027MITPHPPHP &gt;=7.4

Since May 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AZWhosting/spark-crud-generator)[ Packagist](https://packagist.org/packages/azwhosting/spark-crud-generator)[ RSS](/packages/azwhosting-spark-crud-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (8)Used By (0)

🚀 Spark CRUD Generator for CodeIgniter 4
========================================

[](#-spark-crud-generator-for-codeigniter-4)

[![Version](https://camo.githubusercontent.com/0b1a728790f23886cf0154347d0c4b710a71dd02424487ae86e2f27205ca4f74/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f415a57686f7374696e672f737061726b2d637275642d67656e657261746f723f6c6162656c3d76657273696f6e26736f72743d73656d766572)](https://camo.githubusercontent.com/0b1a728790f23886cf0154347d0c4b710a71dd02424487ae86e2f27205ca4f74/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f415a57686f7374696e672f737061726b2d637275642d67656e657261746f723f6c6162656c3d76657273696f6e26736f72743d73656d766572)[![License](https://camo.githubusercontent.com/e906c2945d0b33679ede1d968666e322649f89e1628082ae2729da6eaeed69ba/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f415a57686f7374696e672f737061726b2d637275642d67656e657261746f72)](https://camo.githubusercontent.com/e906c2945d0b33679ede1d968666e322649f89e1628082ae2729da6eaeed69ba/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f415a57686f7374696e672f737061726b2d637275642d67656e657261746f72)[![PHP](https://camo.githubusercontent.com/983ae72c436b80b073bcbb7a25e3fb4f47d0dd0dbf41e6af7d11881b4ebdac72/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e342d626c7565)](https://camo.githubusercontent.com/983ae72c436b80b073bcbb7a25e3fb4f47d0dd0dbf41e6af7d11881b4ebdac72/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e342d626c7565)[![CI4 Compatible](https://camo.githubusercontent.com/5d9df068075e409ac010d32fddcc6e3df21e201f58bc885f332aa7ac9f66ae18/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f646549676e697465722d342e782d726564)](https://camo.githubusercontent.com/5d9df068075e409ac010d32fddcc6e3df21e201f58bc885f332aa7ac9f66ae18/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f646549676e697465722d342e782d726564)

Choose your language / Choisissez votre langue :

- [🇬🇧 English](#-english-version)
- [🇫🇷 Français](#-version-fran%C3%A7aise)

---

🇬🇧 English version
------------------

[](#-english-version)

### 📚 Table of Contents

[](#-table-of-contents)

- [✨ Features](#-features)
- [⚙️ Installation](#installation)
- [🚀 Usage](#-usage)
- [📄 Options](#-options)
- [🌍 Localization](#-localization)
- [📁 Generated Structure](#-generated-structure)
- [🛡️ Safeguards](#safeguards)
- [📝 License](#-license)

---

### ✨ Features

[](#-features)

- Generates **Model, Entity, Controller, Views, Migration**
- Interactive prompts for field definitions
- Language support (English &amp; French)
- No file overwrite without confirmation
- `--force` mode to skip confirmations
- Clean structure: templates and CRUD folders
- Auto migration execution prompt
- Routes summary automatically displayed after generation
- Direct clickable link to CRUD interface
- Full entity support with `Entity` as object (no array access)
- Supports template themes (e.g., default, bootstrap, etc.)
- Modular architecture with dedicated classes per generator (model, controller, views, etc.)
- All code is rendered from .tpl files for full customization
- Header and footer layout support via layout templates
- Detects missing routes and optionally injects them into Routes.php

---

### ⚙️ Installation

[](#️-installation)

#### Using Composer (recommended)

[](#using-composer-recommended)

```
composer require azwhosting/spark-crud-generator --dev
```

Then publish the language files:

```
php spark crud:publish-lang
```

### ⚙️ Manual Installation

[](#️-manual-installation)

You can install the generator manually if you don't use Composer.

**Manual installation steps:**

1. Place the following files in your project:

```
app/Commands/MakeCrud.php
app/Language/en/CrudGenerator.php
app/Language/fr/CrudGenerator.php

```

> 📌 Create the folders if they don’t exist.

2. Run the generator from the Spark CLI:

```
php spark make:crud
```

3. Follow the interactive prompts to generate your CRUD.

You can now call it via Spark CLI.

---

### 🚀 Usage

[](#-usage)

```
php spark make:crud
```

Follow the prompts:

- Entity name
- Add fields one by one
- File creation with overwrite protection

Example:

```
php spark make:crud Product
```

---

### 🧩 Custom Templates

[](#-custom-templates)

You can define your own generation theme by duplicating the default templates:

1. Copy the folder `resources/templates/default/` into a new folder `resources/templates/your-theme/`
2. Customize any `.tpl` file (controller, model, views, etc.)
3. Run `php spark make:crud` and select your theme when prompted

Templates use placeholders like `{{entity}}`, `{{fields}}`, `{{formFields}}`, etc.

---

### 🔄 Automatic Route Injection

[](#-automatic-route-injection)

After generation, the system offers to automatically inject routes into `app/Config/Routes.php`.

- If routes already exist, they will be skipped.
- If missing, the lines from `route.tpl` will be inserted after confirmation.
- A backup of `Routes.php` is automatically created before any modification.
- Manual fallback is always shown in case of conflict or refusal.

You can customize the injected routes by editing the `route.tpl` file inside your selected template.

---

### 📄 Options

[](#-options)

OptionDescription`--force` or `-f`Force overwrite without any confirmation---

### 🌍 Localization

[](#-localization)

Language files are located in:

```
app/Language/en/CrudGenerator.php
app/Language/fr/CrudGenerator.php

```

You can edit them or create your own translations.

---

### 📁 Generated Structure

[](#-generated-structure)

```
app/
├── Controllers/
│   └── ProductController.php
├── Entities/
│   └── Product.php
├── Models/
│   └── ProductModel.php
├── Views/
│   ├── product/
│   │   ├── index.php
│   │   ├── create.php
│   │   ├── edit.php
│   │   └── show.php
│   └── templates/
│       ├── header.php
│       └── footer.php
├── Database/
│   └── Migrations/
│       └── 2025-01-01-CreateProductTable.php

```

---

### 🛡️ Safeguards

[](#️-safeguards)

- Checks if CRUD already exists
- Warns if a table already exists in DB
- Asks before overwriting any file
- Bypass everything with `--force`

---

### 📝 License

[](#-license)

MIT License — Free to use, modify, share.

---

🇫🇷 Version française
--------------------

[](#-version-française)

### 📚 Sommaire

[](#-sommaire)

- [✨ Fonctionnalités](#-fonctionnalit%C3%A9s)
- [⚙️ Installation](#installation-1)
- [🚀 Utilisation](#-utilisation)
- [📄 Options](#-options-1)
- [🌍 Localisation](#-localisation)
- [📁 Structure générée](#-structure-g%C3%A9n%C3%A9r%C3%A9e)
- [🛡️ Sécurités](#s%C3%A9curit%C3%A9s)
- [📝 Licence](#-licence)

---

### ✨ Fonctionnalités

[](#-fonctionnalités)

- Génère **Modèle, Entité, Contrôleur, Vues, Migration**
- Interface interactive pour les champs
- Prise en charge de plusieurs langues (FR / EN)
- Aucun fichier écrasé sans confirmation
- Mode `--force` pour tout passer en force
- Structure claire : templates et vues par entité
- Suggestion d'exécution automatique de la migration
- Récapitulatif complet des routes à ajouter
- Lien cliquable direct vers l'interface CRUD générée
- Support complet des entités sous forme d'objets (plus d'accès tableau)
- Prise en charge des thèmes de templates (ex. : `default`, `bootstrap`, etc.)
- Architecture modulaire avec une classe dédiée par générateur (modèle, contrôleur, vues, etc.)
- Tout le code est généré à partir de fichiers `.tpl` entièrement personnalisables
- Gestion des layouts `header` et `footer` via des templates dédiés
- Détection des routes manquantes et injection automatique optionnelle dans `Routes.php`

---

### ⚙️ Installation

[](#️-installation-1)

#### Via Composer (recommandé)

[](#via-composer-recommandé)

```
composer require azwhosting/spark-crud-generator --dev
```

Puis publiez les fichiers de langue :

```
php spark crud:publish-lang
```

### ⚙️ Installation manuelle

[](#️-installation-manuelle)

Vous pouvez installer le générateur manuellement si vous n'utilisez pas Composer.

**Étapes pour une installation manuelle :**

1. Placez les fichiers suivants dans votre projet :

```
app/Commands/MakeCrud.php
app/Language/en/CrudGenerator.php
app/Language/fr/CrudGenerator.php

```

> 📌 Créez les dossiers s'ils n'existent pas.

2. Lancez le générateur depuis le terminal Spark :

```
php spark make:crud
```

3. Suivez les instructions interactives pour générer le CRUD.

---

### 🧩 Templates personnalisés

[](#-templates-personnalisés)

Vous pouvez définir votre propre thème de génération en dupliquant les templates par défaut :

1. Copiez le dossier `resources/templates/default/` vers un nouveau dossier `resources/templates/votre-theme/`
2. Personnalisez les fichiers `.tpl` (contrôleur, modèle, vues, etc.)
3. Lancez la commande `php spark make:crud` et sélectionnez votre thème lorsqu’il est proposé

Les templates utilisent des balises comme `{{entity}}`, `{{fields}}`, `{{formFields}}`, etc.

---

🔄 Injection automatique des routes
----------------------------------

[](#-injection-automatique-des-routes)

À la fin de la génération, le système vous propose d’ajouter automatiquement les routes dans `app/Config/Routes.php`.

- Si les routes existent déjà, elles seront ignorées.
- Si elles sont absentes, les lignes de `route.tpl` seront insérées après confirmation.
- Une sauvegarde du fichier `Routes.php` est automatiquement créée avant toute modification.
- Un rappel manuel est toujours affiché en cas de refus ou de conflit.

Vous pouvez personnaliser les routes injectées en modifiant le fichier `route.tpl` du thème utilisé

---

### 🚀 Utilisation

[](#-utilisation)

```
php spark make:crud
```

Répondez aux questions :

- Nom de l'entité
- Ajout des champs un à un
- Création des fichiers avec protections

Exemple :

```
php spark make:crud Produit
```

---

### 📄 Options

[](#-options-1)

OptionDescription`--force` ou `-f`Forcer l'écrasement des fichiers sans avertissement---

### 🌍 Localisation

[](#-localisation)

Les fichiers de langue sont ici :

```
app/Language/en/CrudGenerator.php
app/Language/fr/CrudGenerator.php

```

Vous pouvez les modifier ou en ajouter d'autres.

---

### 📁 Structure générée

[](#-structure-générée)

```
app/
├── Controllers/
│   └── ProduitController.php
├── Entities/
│   └── Produit.php
├── Models/
│   └── ProduitModel.php
├── Views/
│   ├── produit/
│   │   ├── index.php
│   │   ├── create.php
│   │   ├── edit.php
│   │   └── show.php
│   └── templates/
│       ├── header.php
│       └── footer.php
├── Database/
│   └── Migrations/
│       └── 2025-01-01-CreateProduitTable.php

```

---

### 🛡️ Sécurités

[](#️-sécurités)

- Vérifie si le CRUD existe déjà
- Préviens si une table est déjà présente dans la BDD
- Demande avant de remplacer un fichier
- `--force` pour tout automatiser

---

### 📝 Licence

[](#-licence)

Licence MIT — Utilisation libre et modification autorisée.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance49

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Total

7

Last Release

371d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e6f93fa2fd9fc67261d545f16f9f8e612e2cec20cb3dc76a3cf39efd74729038?d=identicon)[AZWhosting](/maintainers/AZWhosting)

---

Top Contributors

[![AZWhosting](https://avatars.githubusercontent.com/u/2768137?v=4)](https://github.com/AZWhosting "AZWhosting (13 commits)")

### Embed Badge

![Health badge](/badges/azwhosting-spark-crud-generator/health.svg)

```
[![Health](https://phpackages.com/badges/azwhosting-spark-crud-generator/health.svg)](https://phpackages.com/packages/azwhosting-spark-crud-generator)
```

PHPackages © 2026

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