PHPackages                             dhavalrajput/code-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. [API Development](/categories/api)
4. /
5. dhavalrajput/code-generator

ActiveLibrary[API Development](/categories/api)

dhavalrajput/code-generator
===========================

A Laravel package with a web interface to easily create full CRUD APIs — like models, controllers, migrations, services, traits, notifications, policies, and more. Built using Laravel and Livewire.

v2.0.1(11mo ago)03MITPHPPHP ^8.2

Since Jun 3Pushed 10mo agoCompare

[ Source](https://github.com/dhaval-j-r-7span/laravel-code-generator-demo)[ Packagist](https://packagist.org/packages/dhavalrajput/code-generator)[ RSS](/packages/dhavalrajput-code-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Laravel Code Generator
======================

[](#laravel-code-generator)

A developer-friendly Laravel package to **generate models, migrations, controllers, requests, resources, factories, policies, observers, services, notifications, and traits** using a modern Livewire-powered UI.

This package is designed to **accelerate API development** in Laravel by providing a visual interface for defining models, fields, relationships, and scaffolding complete REST endpoints.

---

🚀 Features
----------

[](#-features)

- **REST API Generator**: Instantly scaffold Models, Controllers, Migrations, Services, Resources, Requests, and more.
- **Livewire UI**: Interactive, dynamic interface for rapid development.
- **Trait Support**: Easily add reusable traits to your models via the UI.
- **Validation &amp; Error Handling**: Smart file handling with overwrite protection.
- **Highly Configurable**: Customize paths, namespaces, route prefixes, and stub templates.
- **Smart File Placement**: Files are created in Laravel-standard folders.
- **Log Viewer**: View package logs directly from the UI for troubleshooting and transparency.

---

🧩 Requirements
--------------

[](#-requirements)

- Laravel 12+
- PHP 8.2+
- [Livewire 3](https://livewire.laravel.com/)
- [spatie/laravel-query-builder](https://github.com/spatie/laravel-query-builder)

---

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

[](#-installation)

1. **Install via Composer:**

    ```
    composer require dhavalrajput/code-generator
    ```
2. **Publish the configuration and migrations:**

    ```
    php artisan vendor:publish --tag=code-generator-config
    php artisan vendor:publish --tag=code-generator-migrations
    ```
3. **(Optional) Customize configuration:**

    Edit `config/code-generator.php` to set route paths, folder locations, and stub templates as needed.

---

🖥️ Usage
--------

[](#️-usage)

📽️ Demo
-------

[](#️-demo)

- [!\[Watch the demo\]](https://www.loom.com/share/631c4dbc840d475ea4516a8dafcc5b80)

1. **Access the UI**

    Visit:

    ```
    http://yourdomain.com/code-generator

    ```
2. **Define your model, fields, and relationships**

    - Use the UI to add fields (columns), set data types, validation, and foreign keys.
    - Add Eloquent relationships visually (hasOne, hasMany, belongsToMany, etc.).
    - Select which files to generate (model, migration, controller, etc.).
    - Optionally, select other features like traits, observers, and notifications.
3. **Generate Files**

    - Click "Generate" to scaffold all selected files in your Laravel app.

---

📜 Logs
------

[](#-logs)

- The package provides a log viewer in the UI to help you review generation activity and errors.
- **To clear the logs**, run the following Artisan command:

    ```
    php artisan code-generator:clear-logs
    ```

---

⚙️ Configuration
----------------

[](#️-configuration)

The main configuration file is published at `config/code-generator.php`.
You can customize:

- Route path and prefix
- Folder paths for generated files
- Stub templates for each file type

---

🧑‍💻 Contributing
----------------

[](#‍-contributing)

Pull requests and issues are welcome!

- Fork the repo
- Create a new branch: `git checkout -b feature/my-feature`
- Commit your changes and push
- Open a Pull Request

---

📄 License
---------

[](#-license)

The MIT License (MIT).

---

**Happy coding! 🚀**

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance53

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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

Total

3

Last Release

346d ago

Major Versions

v1.0.0 → v2.0.02025-06-06

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

v2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4fe448cd743d1d4c2d9ec8b79a446182ca7d79e3a061a840abcc4ade5581b828?d=identicon)[dhavalrajput04](/maintainers/dhavalrajput04)

---

Top Contributors

[![dhaval-j-r-7span](https://avatars.githubusercontent.com/u/205601895?v=4)](https://github.com/dhaval-j-r-7span "dhaval-j-r-7span (15 commits)")

### Embed Badge

![Health badge](/badges/dhavalrajput-code-generator/health.svg)

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

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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