redberryproducts/laravel-packager

Package to easily initiate new package using spatie's laravel package skeleton

v1.0.2 2025-04-16 08:40 UTC

This package is auto-updated.

Last update: 2025-04-16 08:47:59 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel Packager is a streamlined Laravel package designed to simplify the creation of new package skeletons within your project. With minimal effort, it clones a customizable skeleton repository, detaches it from its original Git history, and seamlessly integrates the new package into your application’s composer.json. By automating these steps, Laravel Packager eliminates the friction of package initialization, making it effortless to extract reusable features into standalone packages for enhanced modularity and maintainability.

Installation

You can install the package via composer:

composer require redberryproducts/laravel-packager

You can publish the config file with:

php artisan vendor:publish --tag="packager-config"

This is the contents of the published config file:

return [
    'default_skeleton' => 'spatie',
    'skeletons' => [
        'spatie' => [
            'url' => 'https://github.com/spatie/package-skeleton-laravel.git',
            'branch' => 'main',
            'runs' => [
                'php configure.php',
            ],
        ],
    ],
    'packages_directory' => 'packages',
];

If you want to add another skeleton, or create your custom skeleton and give package ability to initilize this inside your project, you will need to do the following:

  1. Create a package skeleton github repository
  2. Add new entry to skeletons list inside the published config
  3. Modify default_skeletons to reflect new skeleton name

Usage

php artisan make:package vendor-name/package-name

For example:

php artisan make:package acme/example

This command: Clones the Spatie skeleton (or your configured skeleton) to packages/acme/example.

Initializes a new Git repository, detaching it from the skeleton’s history.

Updates composer.json to include:

{
    "repositories": [
        {
            "type": "path",
            "url": "./packages/acme/example",
            "options": {
                "symlink": true
            }
        }
    ],
    "require-dev": {
        "acme/example": "*"
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.