Skip to content
Plug and play packages for Laravel
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
stubs
.gitignore
.travis.yml
composer.json
license.md
readme.md

readme.md

Laravel Plug and Play

Add to the Laravel application the ability to plug and play packages that are build with package discover without necessarily installing a new dependency on composer.json.

This package uses the great plugin Composer Merge Plugin which allows you to merge multiple composer.json files into the Composer runtime.

Installation

Laravel Plug and Play requires Composer 1.0.0 or newer.

composer require edersoares/laravel-plug-and-play

php artisan package:install

Usage

The composer.json file needs to be updated to something like:

{
    "require": {
        "edersoares/laravel-plug-and-play": "^1.0"
    },
    "extra": {
        "merge-plugin": {
            "include": [
                "packages/*/*/composer.json"
            ]
        }
    }
}

This package is a Composer Merge Plugin extension and its features can be used usually. See more in plugin configuration.

Adding a package

Move or clone the package to packages/<vendor>/<name> folder and runs:

composer update --lock 

Whenever package dependencies are updated, this command must be executed.

This will instruct Composer to recalculate the file hash for the top-level composer.json thus triggering composer-merge-plugin to look for the sub-level configuration files and update your dependencies.

https://github.com/wikimedia/composer-merge-plugin#updating-sub-levels-composerjson-files

Creating a package

To create a package execute:

php artisan package:create <vendor>/<name>

This will create a package in packages folder:

packages
\_ <vendor>
  \_ <name>
    \_ src
      \_ ServiceProvider.php
    \_ composer.json

See the official documentation about package discover.

Removing a package

Just only remove the package folder and runs:

composer update --lock 

License

Laravel Plug and Play is licensed under the MIT license. See the license file for more details.

You can’t perform that action at this time.