PHPackages                             hasanhawary/dynamic-cli - 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. [CLI &amp; Console](/categories/cli)
4. /
5. hasanhawary/dynamic-cli

ActiveLibrary[CLI &amp; Console](/categories/cli)

hasanhawary/dynamic-cli
=======================

A Laravel package providing a dynamic CLI scaffolder for CRUD generation (skeleton).

v1.1.0(6mo ago)2140MITPHPPHP &gt;=8.0CI failing

Since Oct 16Pushed 6mo agoCompare

[ Source](https://github.com/hasanhawary/dynamic-cli)[ Packagist](https://packagist.org/packages/hasanhawary/dynamic-cli)[ Docs](https://github.com/hasanhawary/dynamic-cli)[ RSS](/packages/hasanhawary-dynamic-cli/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (12)Used By (0)

Absolutely! I’ve written a **full, highly detailed, professional README** for your **Dynamic CLI CRUD** package, with all advanced features, CLI flow, schema examples, enums, translatable fields, relations, file uploads, and best Laravel package practices.

Here’s the **complete README** you can directly use:

---

🧠 Dynamic CLI CRUD Generator for Laravel
========================================

[](#-dynamic-cli-crud-generator-for-laravel)

[![Latest Stable Version](https://camo.githubusercontent.com/07fe94faba3cec3541d15c255724864463000b25dbf71307bd6122e9cd6011d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686173616e6861776172792f64796e616d69632d636c692e737667)](https://packagist.org/packages/hasanhawary/dynamic-cli)[![Total Downloads](https://camo.githubusercontent.com/ffa09864da2895c22cb4de75077089b8ef90fd6daf04dee530273c03a2843ec0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f686173616e6861776172792f64796e616d69632d636c692e737667)](https://packagist.org/packages/hasanhawary/dynamic-cli)[![PHP Version](https://camo.githubusercontent.com/1fc9ce310849dc2083142ace3257ff22558066b3a75ffc9c74e710b9728ef5c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f686173616e6861776172792f64796e616d69632d636c692e737667)](https://packagist.org/packages/hasanhawary/dynamic-cli)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

**Dynamic CLI CRUD** is a **smart, interactive generator** for Laravel that creates **production-ready CRUD modules** (models, controllers, requests, resources, migrations, enums) with **automatic schema detection, relations, enums, translatable fields, and file handling**.

---

✨ Key Features
--------------

[](#-key-features)

- 🧠 **Smart Schema Detection**: Detects field types, required fields, unique constraints, enums, file uploads, and relations automatically.
- 🎯 **Enum Handling**: Automatically generates Enum classes for fields like `status = enum[pending,approved,rejected]`.
- 🌍 **Translatable Fields**: Detects multilingual fields (`ar`, `en`, etc.) and stores them in JSON columns.
- 🔗 **Relations Awareness**: Detects `belongsTo` foreign keys (e.g., `country_id`) and sets up metadata for CRUD.
- 🖼️ **File Uploads**: Supports file fields (`file`, `image`, etc.) with category and allowed file types.
- ⚡ **Interactive CLI**: Step-by-step guidance for CRUD generation.
- 📦 **Full CRUD Generation**: Creates Model, Controller, Request, Resource, Migration, and Enum classes automatically.
- 💪 **Force Overwrite**: Re-generate existing files safely using `--force`.
- 🌐 **Optional Frontend Integration**: Specify a frontend path to scaffold integration-ready modules.
- 📝 **Detailed Schema Analysis**: Shows a complete mapping of all fields with metadata in CLI before generation.

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require hasanhawary/dynamic-cli --dev
```

> ✅ Auto-discovers the service provider. No manual registration needed.

---

⚡ Quick Start
-------------

[](#-quick-start)

Generate a CRUD module interactively:

```
php artisan cli:crud Product
```

Or provide the name directly and force overwrite if needed:

```
php artisan cli:crud Product --force
```

---

### 🔹 Example CLI Flow

[](#-example-cli-flow)

```
==============================================

   🧠 Dynamic CLI CRUD Generator
        Build smart CRUDs in seconds
      ⚡ Powered by Hasan Hawary

==============================================

👋 Welcome!

Enter group name (default: DataEntry) [DataEntry]:
>

Custom table name? (press Enter for default) [products]:
>

Do you have a custom JSON schema? (yes/no) [no]:
> yes

💡 Schema Reference Guide
-------------------------------------------------------------
Symbol-based field modifiers:
  * => required field (is_nullable = false)
  ^ => unique field (is_unique = true)
  enum[...] => enumeration field (is_enum = true)
Examples:
  '*price'  => 'float'
  '^email'  => 'string'
  'state'   => 'enum[draft,published,archived]'
  'name'    => ['ar' => '...', 'en' => '...'] // translatable field
  'photo'   => 'file'
  'country_id' => 1 // foreign key
-------------------------------------------------------------

Opening temporary file... Write your JSON schema and save/close.

```

---

### 🔹 JSON Schema Example

[](#-json-schema-example)

```
{
  "*name": {
    "ar": "اسم المنتج",
    "en": "Product Name"
  },
  "description": {
    "ar": "وصف المنتج",
    "en": "Product Description"
  },
  "^phone": "string",
  "photo": "file",
  "status": "enum[pending,approved,rejected]",
  "country_id": 1
}
```

---

### 🔹 Final Schema Mapping (CLI Output)

[](#-final-schema-mapping-cli-output)

```
🧠 Analyzing schema...

📋 Final Schema Mapping:
 - name        → json       (🌍 translatable, 🚫 not null)
 - description → json       (🌍 translatable)
 - phone       → string     (🔑 unique)
 - photo       → file       (🖼️ file(jpg|jpeg|png|pdf|doc|docx))
 - status      → string     (🎯 enum[pending|approved|rejected])
 - country_id  → foreignId  (🔗 relation(Country))

```

---

🏗 CRUD File Generation
----------------------

[](#-crud-file-generation)

After confirmation, the generator creates:

File TypePath ExampleEnum`app/Enum/DataEntry/StatusEnum.php`Model`app/Models/Product.php`Controller`app/Http/Controllers/API/DataEntry/ProductController.php`Request`app/Http/Requests/DataEntry/ProductRequest.php`Resource`app/Http/Resources/DataEntry/ProductResource.php`Migration`database/migrations/2025_10_22_172830_create_products_table.php`> Next steps:

```
php artisan migrate
```

---

🔹 Advanced Features
-------------------

[](#-advanced-features)

### Enum Handling 🎯

[](#enum-handling-)

- Automatically generates Enum classes for any field defined as `enum[...]`.
- Enum classes include a static `resolve($value)` method for easy mapping.

```
$status = StatusEnum::resolve('pending'); // returns 'pending'
```

---

### Translatable Fields 🌍

[](#translatable-fields-)

- Detects JSON structures with language keys (`ar`, `en`).
- Stores translations in **JSON column** for multilingual support.

```
"*name": { "ar": "اسم المنتج", "en": "Product Name" }
```

---

### Relations Detection 🔗

[](#relations-detection-)

- Detects fields ending with `_id` or typed as `foreignId`.
- Prepares metadata for `belongsTo` relationships automatically.

```
"country_id": 1
```

- Generates relation info for controller, resource, and request.

---

### File Uploads 🖼️

[](#file-uploads-️)

- Supports file fields (`file`, `image`, `pdf`, `docx`).
- Detects category and allowed file types.
- Integrates with Laravel file handling in requests.

```
"photo": "file"
```

---

### CLI Options &amp; Metadata

[](#cli-options--metadata)

- **Force**: `--force` to overwrite existing files.
- **Group**: Organize CRUD modules by logical group (e.g., DataEntry).
- **Table Name**: Auto-generated from model name but customizable.
- **Route**: Default `api`, can be extended to `web`.

---

🔧 Optional Frontend Integration
-------------------------------

[](#-optional-frontend-integration)

The CLI can scaffold integration-ready modules for your frontend:

```
Would you like to integrate this module with a frontend project? (yes/no)
> yes

Please specify the absolute path to your frontend project:
> /path/to/frontend

```

---

🤝 Contribution
--------------

[](#-contribution)

1. Fork the repository
2. Create a feature branch:

```
git checkout -b feature/my-feature
```

3. Commit your changes:

```
git commit -am "Add new feature"
```

4. Push the branch:

```
git push origin feature/my-feature
```

5. Open a pull request

---

📦 Version Support
-----------------

[](#-version-support)

- **PHP**: 8.1 – 8.3
- **Laravel**: 10.x

---

📜 License
---------

[](#-license)

MIT © Hasan Hawary

---

🔗 Links
-------

[](#-links)

- GitHub:
- Packagist:

---

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance68

Regular maintenance activity

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Total

11

Last Release

186d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33836947?v=4)[Hassan Elhawary](/maintainers/hasanhawary)[@hasanhawary](https://github.com/hasanhawary)

---

Top Contributors

[![hasanhawary](https://avatars.githubusercontent.com/u/33836947?v=4)](https://github.com/hasanhawary "hasanhawary (5 commits)")

---

Tags

clilaravelscaffoldinggeneratorcrud

### Embed Badge

![Health badge](/badges/hasanhawary-dynamic-cli/health.svg)

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

###  Alternatives

[nunomaduro/laravel-console-menu

Laravel Console Menu is an output method for your Laravel/Laravel Zero commands.

815412.0k48](/packages/nunomaduro-laravel-console-menu)[nunomaduro/laravel-console-dusk

Laravel Console Dusk allows the usage of Laravel Dusk in Laravel/Laravel Zero artisan commands.

16255.4k7](/packages/nunomaduro-laravel-console-dusk)[rahul900day/laravel-console-spinner

Laravel Console Spinner is a spinner output for Laravel command line.

76125.4k1](/packages/rahul900day-laravel-console-spinner)[timwassenburg/laravel-repository-generator

Generate Laravel repositories

2116.9k1](/packages/timwassenburg-laravel-repository-generator)[socialengine/sniffer-rules

A Lumen 5 and Laravel 5 SquizLabs Code Sniffer 2.0 artisan command. Detect violations of a defined coding standard. It helps your code remains clean and consistent.

1248.2k1](/packages/socialengine-sniffer-rules)[sunaoka/laravel-facade-generator

Provide command line generation of facade layer files.

171.9k](/packages/sunaoka-laravel-facade-generator)

PHPackages © 2026

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