PHPackages                             sevenspan/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. sevenspan/code-generator

ActiveLibrary[API Development](/categories/api)

sevenspan/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.

v1.1.1(6mo ago)050[2 PRs](https://github.com/7span/laravel-code-generator/pulls)MITPHPPHP ^8.2

Since Jun 6Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/7span/laravel-code-generator)[ Packagist](https://packagist.org/packages/sevenspan/code-generator)[ RSS](/packages/sevenspan-code-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (14)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 sevenspan/code-generator --dev
    ```
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.

---

📽️ Demo
-------

[](#️-demo)

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

🖥️ Usage
--------

[](#️-usage)

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: 🔹 Manually (Artisan) ```
    php artisan code-generator:clear-logs --days
    ```
- option days will clear logs older than provided days.

🔹 Automatically (Laravel 12+) Add this in bootstrap/app.php:

```
scheduler()
    ->command('code-generator:clear-logs')
    ->daily(); // or weekly/monthly

```

---

⚙️ 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

42

—

FairBetter than 90% of packages

Maintenance79

Regular maintenance activity

Popularity9

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

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

Total

4

Last Release

194d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/08bf8e5911bd55b6328d8e1a32c786000dc7023bc741cbad255a2625ed91a75b?d=identicon)[hemratna](/maintainers/hemratna)

---

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 (80 commits)")[![kajal-7span](https://avatars.githubusercontent.com/u/107455736?v=4)](https://github.com/kajal-7span "kajal-7span (79 commits)")[![Mruganshi123](https://avatars.githubusercontent.com/u/145362395?v=4)](https://github.com/Mruganshi123 "Mruganshi123 (55 commits)")[![mruganshi-7span](https://avatars.githubusercontent.com/u/205601566?v=4)](https://github.com/mruganshi-7span "mruganshi-7span (45 commits)")[![binal-7span](https://avatars.githubusercontent.com/u/19200178?v=4)](https://github.com/binal-7span "binal-7span (21 commits)")[![harshil-7span](https://avatars.githubusercontent.com/u/86794709?v=4)](https://github.com/harshil-7span "harshil-7span (20 commits)")[![sandip-b-7span](https://avatars.githubusercontent.com/u/115146134?v=4)](https://github.com/sandip-b-7span "sandip-b-7span (20 commits)")[![sanjay-7span](https://avatars.githubusercontent.com/u/108665992?v=4)](https://github.com/sanjay-7span "sanjay-7span (17 commits)")[![charmy-7span](https://avatars.githubusercontent.com/u/113334991?v=4)](https://github.com/charmy-7span "charmy-7span (16 commits)")[![nikunj-7span](https://avatars.githubusercontent.com/u/92076426?v=4)](https://github.com/nikunj-7span "nikunj-7span (15 commits)")[![meet-7span](https://avatars.githubusercontent.com/u/101455648?v=4)](https://github.com/meet-7span "meet-7span (15 commits)")[![ujas-7span](https://avatars.githubusercontent.com/u/109651349?v=4)](https://github.com/ujas-7span "ujas-7span (14 commits)")[![akshay-m-7span](https://avatars.githubusercontent.com/u/155456074?v=4)](https://github.com/akshay-m-7span "akshay-m-7span (12 commits)")[![dhanush-7span](https://avatars.githubusercontent.com/u/105055628?v=4)](https://github.com/dhanush-7span "dhanush-7span (4 commits)")[![datta-7span](https://avatars.githubusercontent.com/u/155405009?v=4)](https://github.com/datta-7span "datta-7span (3 commits)")[![sanjay-prom](https://avatars.githubusercontent.com/u/128028551?v=4)](https://github.com/sanjay-prom "sanjay-prom (3 commits)")[![dhrumin-7span](https://avatars.githubusercontent.com/u/155510284?v=4)](https://github.com/dhrumin-7span "dhrumin-7span (1 commits)")[![champakchopda](https://avatars.githubusercontent.com/u/65281433?v=4)](https://github.com/champakchopda "champakchopda (1 commits)")[![urvashi-7span](https://avatars.githubusercontent.com/u/50007336?v=4)](https://github.com/urvashi-7span "urvashi-7span (1 commits)")

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/sevenspan-code-generator/health.svg)](https://phpackages.com/packages/sevenspan-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)
