luna/laravel-packager

Create a Laravel package template with ease
15 1
Install
composer require luna/laravel-packager
Latest Version:1.1.0
PHP:>=5.5
License:MIT
Last Updated:Mar 15, 2017
Links: GitHub  ·  Packagist
Maintainer: DuckThom
    composer require luna/laravel-packager "~1.0"

Then, add the service provider to config/app.php:

    "providers" => [
        // snip
        Luna\Packager\ServiceProvider::class,
    ];

If you want to use the package in the current project without adding it to, for example, packagist just yet, ie. for development, add the following line to your main project's composer.json:

{
    "autoload": {
        "classmap": [
            "database",
            "packages"   #  Add this line to your main projects composer.json
        ],
        "psr-4": {
            "App\\": "app/",
            "Tests\\": "tests/"
        }
    }
}

After adding that line, run composer dump, and add the package's service provider to config/app.php.

For example, you made a package which has the following structure: <project_root>/packages/Foo/Bar/BarServiceProvider.php.

When you add the line to the composer.json in the project root, you can use that service provider with it's usual namespace: Foo\Bar\BarServiceProvider::class.

    php artisan make:package <Vendor> <Package> [--base-dir=packages]

Be default, the package files are created in <project_root>/packages/Vendor/Package.

By specifying --base-dir in the make:package command, you can change where the files are placed.