PHPackages                             goez/laravel-api-forge - 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. goez/laravel-api-forge

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

goez/laravel-api-forge
======================

A powerful command-line tool for scaffolding Laravel API projects with modern development practices and essential packages pre-configured.

1.0.6(11mo ago)03MITPHPPHP ^8.2

Since Jul 19Pushed 11mo agoCompare

[ Source](https://github.com/goez-tools/laravel-api-forge)[ Packagist](https://packagist.org/packages/goez/laravel-api-forge)[ Docs](https://github.com/goez-tools/laravel-api-forge)[ RSS](/packages/goez-laravel-api-forge/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (5)Versions (8)Used By (0)

Laravel API Forge
=================

[](#laravel-api-forge)

[![PHP Version](https://camo.githubusercontent.com/c5e8da782b1a0673c08b4f474108036d2cc973470eed2d5d89d48e8c8475eee6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d626c75652e737667)](https://www.php.net/)[![Laravel](https://camo.githubusercontent.com/2c4122030cabc035a7e5c25081c0a54d2f768efc75501c62ef0379afa398258d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25334525334431312e302d7265642e737667)](https://laravel.com/)[![Laravel Installer](https://camo.githubusercontent.com/9ec142ed7914f154d511f30d513138ec84e95be3a957b49e1d653eb5657d8a42/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d2d696e7374616c6c65722d253345253344352e302d6f72616e67652e737667)](https://laravel.com/docs/installation)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

*[正體中文](README.ZH-TW.md) | English*

Laravel API Forge is a powerful command-line tool that helps you quickly scaffold a complete Laravel API project with modern development practices and essential packages pre-configured. It's built on top of Laravel Zero and automates the setup of a production-ready Laravel API with optional features like Redis caching, RBAC (Role-Based Access Control), and modular architecture.

✨ Features
----------

[](#-features)

- **🚀 Quick Setup**: Create a complete Laravel API project in minutes
- **🔧 Environment Validation**: Automatically checks for required tools and versions
- **📝 Code Quality**: Automatic code formatting with Laravel Pint
- **🔄 Git Integration**: Step-by-step Git commits with meaningful messages
- **🐳 Docker Ready**: Laravel Sail configuration with MySQL and Redis
- **🔐 Authentication**: Laravel Sanctum API authentication setup
- **📊 Database**: MySQL database configuration with Laravel Sail
- **⚡ Redis Cache**: Optional Redis caching configuration
- **🛡️ RBAC System**: Optional role-based access control with Spatie Permission
- **🔐 One-Time-Passwords**: Optional OTP package for enhanced security
- **🧩 Modular Architecture**: Optional Laravel Modules for modular development
- **📚 API Documentation**: Spectator for OpenAPI specification testing
- **🎯 Data Transfer Objects**: Laravel Data for structured data handling
- **🪝 Git Hooks**: Pre-configured Git hooks for code quality checks

📋 Requirements
--------------

[](#-requirements)

Before using Laravel API Forge, make sure you have the following tools installed:

- **PHP 8.2+**: [Download PHP](https://www.php.net/downloads.php)
- **Composer**: [Install Composer](https://getcomposer.org/download/)
- **Laravel Installer 5.0+**: `composer global require laravel/installer`
- **Git**: [Install Git](https://git-scm.com/downloads)

The tool will automatically validate these requirements before starting.

🚀 Installation
--------------

[](#-installation)

Install Laravel API Forge globally using Composer:

```
composer global require goez/laravel-api-forge
```

Make sure your global Composer vendor bin directory is in your `$PATH`. You can add this to your shell profile (`.bashrc`, `.zshrc`, etc.):

```
# For bash/zsh
export PATH="$PATH:$HOME/.composer/vendor/bin"

# Alternative path on some systems
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
```

After installation, you can use the tool globally:

```
laravel-api-forge --version
laravel-api-forge list
```

📖 Usage
-------

[](#-usage)

### Basic Usage

[](#basic-usage)

Create a new Laravel API project:

```
laravel-api-forge new my-api-project
```

### Advanced Usage with Options

[](#advanced-usage-with-options)

```
laravel-api-forge new my-api-project --redis --rbac --otp --modules --test-sqlite
```

### Available Options

[](#available-options)

- `--redis`: Use Redis as the cache store
- `--rbac`: Install and configure RBAC (Role-Based Access Control) package
- `--otp`: Install and configure One-Time-Passwords package
- `--modules`: Install and configure modular architecture with Laravel Modules
- `--test-sqlite`: Use SQLite for testing database (reverts to SQLite after Sail setup)

### Interactive Mode

[](#interactive-mode)

If you don't specify options, the tool will prompt you interactively:

```
laravel-api-forge new my-api-project

# You'll be asked:
# Do you want to use Redis as cache store? (yes/no)
# Do you want to install RBAC package? (yes/no)
# Do you want to install One-Time-Passwords package? (yes/no)
# Do you want to install modular architecture? (yes/no)
# Do you want to use SQLite for testing database? (yes/no)
```

### Self-Update

[](#self-update)

Keep your Laravel API Forge up to date with the built-in self-update feature:

```
# Check for updates
laravel-api-forge self-update --check

# Update to the latest version
laravel-api-forge self-update

# Rollback to the previous version (if needed)
laravel-api-forge self-update --rollback

# Force update even if versions match
laravel-api-forge self-update --force

# Include pre-release versions
laravel-api-forge self-update --pre-release
```

**Note**: The self-update feature only works when using the PHAR build of the tool.

🏗️ What Gets Created
--------------------

[](#️-what-gets-created)

The tool creates a complete Laravel API project with:

### Core Setup

[](#core-setup)

- Laravel 11+ with Pest testing framework
- Laravel Sanctum for API authentication
- API routes with `/v1` prefix
- MySQL database configuration
- Laravel Sail for Docker development environment

### Optional Features (based on your choices)

[](#optional-features-based-on-your-choices)

#### Redis Cache (`--redis`)

[](#redis-cache---redis)

- Redis cache configuration
- Removes database cache migration
- Updates environment files

#### RBAC System (`--rbac`)

[](#rbac-system---rbac)

- Spatie Laravel Permission package
- Team-based permissions support
- Pre-configured User model with roles
- Abilities directory structure

#### One-Time-Passwords (`--otp`)

[](#one-time-passwords---otp)

- One-Time-Passwords package integration
- Enhanced authentication security
- Support for time-based and counter-based OTP
- Easy integration with existing authentication flow

#### Modular Architecture (`--modules`)

[](#modular-architecture---modules)

- Laravel Modules package
- Modular directory structure
- Vite integration for module assets
- Composer merge plugin for module dependencies

### Additional Packages

[](#additional-packages)

- **Laravel Data**: For structured data transfer objects
- **Spectator**: For OpenAPI specification testing
- **Laravel Pint**: For code style formatting

### Development Tools

[](#development-tools)

- Pre-configured Git hooks (pre-commit, pre-push, post-merge)
- Automatic code formatting with Pint
- Environment file synchronization (.env and .env.example)
- Step-by-step Git commits for better history
- Optional SQLite testing database configuration

🔄 Development Workflow
----------------------

[](#-development-workflow)

After creating your project:

```
cd my-api-project

# Start the development environment
./vendor/bin/sail up -d

# Run migrations
./vendor/bin/sail artisan migrate

# Run tests
./vendor/bin/sail composer test

# Code formatting
./vendor/bin/sail composer lint
```

📁 Project Structure
-------------------

[](#-project-structure)

```
my-api-project/
├── app/
│   ├── Models/User.php          # Enhanced with Sanctum & RBAC
│   └── Abilities/               # RBAC abilities (if enabled)
├── docs/v1/                     # API documentation
├── modules/                     # Modular architecture (if enabled)
├── tests/
├── .git-hooks/                  # Pre-configured Git hooks
├── docker-compose.yml           # Laravel Sail configuration
└── vite-module-loader.js        # Module asset loading (if enabled)

```

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

[](#️-configuration)

The tool automatically configures:

- **Database**: MySQL with Laravel Sail
- **Cache**: Redis (if selected) or file-based
- **API**: Sanctum authentication with `/v1` prefix
- **Testing**: Pest with LazilyRefreshDatabase
- **Code Quality**: Laravel Pint with pre-commit hooks

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

📝 License
---------

[](#-license)

Laravel API Forge is open-sourced software licensed under the [MIT license](LICENSE).

🙏 Acknowledgments
-----------------

[](#-acknowledgments)

- Built with [Laravel Zero](https://laravel-zero.com/)
- Inspired by modern Laravel development practices
- Thanks to the Laravel community for the amazing ecosystem

---

**Happy coding! 🚀**

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance51

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Total

7

Last Release

343d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/000012ed8f10873694d29e2f60b7b71171c088d6fd655a695210dd2fe46172b9?d=identicon)[jaceju](/maintainers/jaceju)

---

Tags

apicliconsolelaravelscaffoldlaravel-zeroforge

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/goez-laravel-api-forge/health.svg)

```
[![Health](https://phpackages.com/badges/goez-laravel-api-forge/health.svg)](https://phpackages.com/packages/goez-laravel-api-forge)
```

###  Alternatives

[nunomaduro/laravel-console-menu

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

819430.4k54](/packages/nunomaduro-laravel-console-menu)[nunomaduro/laravel-console-dusk

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

16458.3k8](/packages/nunomaduro-laravel-console-dusk)

PHPackages © 2026

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