x-multibyte/laravel-package-generator

A powerful Laravel package generator with modern tooling and best practices

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/x-multibyte/laravel-package-generator

0.0.1 2025-10-06 08:33 UTC

This package is auto-updated.

Last update: 2025-12-06 08:56:27 UTC


README

A powerful Laravel package that provides an Artisan command to generate complete Laravel packages with modern development tools and best practices.

Features

  • Complete Package Structure: Generates standard Laravel package directory structure
  • Testing Framework: Supports both PHPUnit and Pest testing frameworks
  • Code Quality Tools: Integrated with PHPStan, Larastan, and Laravel Pint
  • CI/CD Ready: Includes GitHub Actions workflow for automated testing
  • Customizable Templates: All stub files can be customized and published
  • Type Safety: Full type declarations and PHPDoc comments
  • Documentation: Auto-generates README and package documentation

Installation

Install the package via Composer:

composer require x-multibyte/laravel-package-generator --dev

The package will automatically register its service provider.

Usage

Basic Package Generation

Generate a new Laravel package with the following command:

php artisan package:new {vendor} {package}

Example:

php artisan package:new acme awesome-package

Available Options

  • --config: Generate package configuration file
  • --facade: Generate package facade
  • --migration: Generate database migrations
  • --model: Generate Eloquent models
  • --controller: Generate controllers
  • --middleware: Generate middleware
  • --view: Generate Blade views
  • --route: Generate route files
  • --test: Generate test files (default: enabled)
  • --ci: Generate CI/CD workflow (default: enabled)

Example with Options

php artisan package:new acme awesome-package --config --facade --migration --model

Configuration

Publish the configuration file to customize package generation:

php artisan vendor:publish --tag=laravel-package-generator-config

This will publish config/laravel-package-generator.php where you can customize:

  • Default package information (author, email, license)
  • Feature flags for components
  • Testing framework preference (PHPUnit or Pest)
  • Stub file locations

Customizing Templates

Publish the stub templates to customize generated files:

php artisan vendor:publish --tag=laravel-package-generator-stubs

This will publish all stub files to resources/stubs/laravel-package-generator/ where you can modify:

  • Package structure templates
  • Service provider templates
  • Test file templates
  • CI/CD workflow templates
  • And more...

Generated Package Structure

The generated package follows Laravel package conventions:

vendor/package/
├── src/
│   ├── Commands/           # Artisan commands
│   ├── Http/
│   │   ├── Controllers/    # Controllers
│   │   └── Middleware/     # Middleware
│   ├── Models/             # Eloquent models
│   ├── Facades/            # Package facades
│   └── PackageServiceProvider.php
├── config/                 # Configuration files
├── database/
│   ├── migrations/         # Database migrations
│   └── factories/          # Model factories
├── resources/
│   └── views/              # Blade templates
├── routes/                 # Route definitions
├── tests/
│   ├── Feature/            # Feature tests
│   └── Unit/               # Unit tests
├── .github/workflows/      # CI/CD workflows
├── composer.json
├── phpunit.xml
├── README.md
└── .gitignore

Code Quality Tools

Generated packages include modern development tools:

Laravel Pint

Automatic code formatting following Laravel conventions:

composer format

PHPStan + Larastan

Static analysis for type safety and code quality:

composer analyse

Testing

Run tests with Pest or PHPUnit:

composer test

All Quality Checks

Run all quality tools at once:

composer quality

CI/CD Integration

Generated packages include GitHub Actions workflow that automatically:

  • Performs code quality checks
  • Validates code formatting
  • Runs static analysis

Requirements

  • PHP 8.3 or later
  • Laravel 11.0 or 12.0

Contributing

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

License

This package is open-sourced software licensed under the MIT license.

Support

If you discover any security vulnerabilities or have questions, please email roy@xmultibyte.com .