A Yeoman generator to quickly scaffold a Laravel package.

Usage no npm install needed!

<script type="module">
  import generatorLaravelPackageScaffolder from '';


Yeoman Laravel Package Generator

Code Climate issues Code Climate maintainability Scrutinizer Travis (.org)

What's this about then

This Yeoman generator will quickly and easily scaffold a Laravel package, getting you up and running within a few seconds.

It will generate the necessary files such as a service provider and a composer file, while also generating placeholder directories for migrations, translations etc.

The service provider will be configured with all the correct settings for loading and/or publishing your assets. Just uncomment what you need and you're done.

For a full overview of the scaffolded files, have a look over here.


If you haven't done so already, install the Yeoman generator:

npm install -g yo

After that, install the scaffolder generator:

npm install -g generator-laravel-package-scaffolder

Using the generator

Run the following command:

yo laravel-package-scaffolder

and follow the instructions.

The resulting scaffolded package

Given a package with the name "MyPackage", the resulting package will have the following directory structure and files:

├── .gitignore
├── composer.json
├── config
│   └── my-package.php
├── database
│   └── migrations
│       └── .gitignore
├── phpstan.neon
├── phpunit.xml
├── public
│   └── .gitignore
├── resources
│   ├── lang
│   │   └── .gitignore
│   └── views
│       └── .gitignore
├── routes
│   └── web.php
├── src
│   ├── Console
│   │   └── Commands
│   │       └── MyPackageCommand.php
│   ├── Providers
│   │   └── MyPackageServiceProvider.php
└── tests
    └── TestCase.php

Using your package

If you want to use your package on the local filesystem in a Laravel app for development purposes, include the package in the app's composer.json file:

"repositories": [
        "type": "path",
        "url": "path/to/your/package/root"

Next, add your package to the require section of the app's composer.json file:

"require": {
    "vendor/package": "*"

After the composer.json file has been updated, run the composer update command:

composer update

This will symlink the package into the app's vendor dir.

Note: If you update your package's composer.json file, you need to run the composer update command again to update the app's autoloader.

This is only necessary for the composer.json file. Changes in any other files in your package will be automatically updated thanks to the symlink.

Testing your package

This generator automatically adds PHPUnit for unit testing and PHPStan for static analysis. Both are added to the composer.json scripts attribute. You can run them using:

  • composer run test
  • composer run analysis






If you discover any security-related issues, please email instead of using the issue tracker.


The generator is fully backed (well, almost fully backed 😐) by unit tests. The test runner of choice is Jest.

Running Tests


Generating code coverage

jest --coverage --coverageDirectory=coverage/jest