Choose your language / Choisissez votre langue :
- ✨ Features
- ⚙️ Installation
- 🚀 Usage
- 📄 Options
- 🌍 Localization
- 📁 Generated Structure
- 🛡️ Safeguards
- 📝 License
- Generates Model, Entity, Controller, Views, Migration
- Interactive prompts for field definitions
- Language support (English & 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
composer require azwhosting/spark-crud-generator --dev
Then publish the language files:
php spark crud:publish-lang
You can install the generator manually if you don't use Composer.
Manual installation steps:
- 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.
- Run the generator from the Spark CLI:
php spark make:crud
- Follow the interactive prompts to generate your CRUD.
You can now call it via Spark CLI.
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
You can define your own generation theme by duplicating the default templates:
- Copy the folder
resources/templates/default/
into a new folderresources/templates/your-theme/
- Customize any
.tpl
file (controller, model, views, etc.) - Run
php spark make:crud
and select your theme when prompted
Templates use placeholders like {{entity}}
, {{fields}}
, {{formFields}}
, etc.
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.
Option | Description |
---|---|
--force or -f |
Force overwrite without any confirmation |
Language files are located in:
app/Language/en/CrudGenerator.php
app/Language/fr/CrudGenerator.php
You can edit them or create your own translations.
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
- Checks if CRUD already exists
- Warns if a table already exists in DB
- Asks before overwriting any file
- Bypass everything with
--force
MIT License — Free to use, modify, share.
- ✨ Fonctionnalités
- ⚙️ Installation
- 🚀 Utilisation
- 📄 Options
- 🌍 Localisation
- 📁 Structure générée
- 🛡️ Sécurités
- 📝 Licence
- 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
etfooter
via des templates dédiés - Détection des routes manquantes et injection automatique optionnelle dans
Routes.php
composer require azwhosting/spark-crud-generator --dev
Puis publiez les fichiers de langue :
php spark crud:publish-lang
Vous pouvez installer le générateur manuellement si vous n'utilisez pas Composer.
Étapes pour une installation manuelle :
- 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.
- Lancez le générateur depuis le terminal Spark :
php spark make:crud
- Suivez les instructions interactives pour générer le CRUD.
Vous pouvez définir votre propre thème de génération en dupliquant les templates par défaut :
- Copiez le dossier
resources/templates/default/
vers un nouveau dossierresources/templates/votre-theme/
- Personnalisez les fichiers
.tpl
(contrôleur, modèle, vues, etc.) - 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.
À 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é
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
Option | Description |
---|---|
--force ou -f |
Forcer l'écrasement des fichiers sans avertissement |
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.
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
- 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 MIT — Utilisation libre et modification autorisée.