edersoares / laravel-plug-and-play
Plug and play packages in Laravel
Installs: 5 181
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 1
Open Issues: 0
Type:composer-plugin
Requires
- php: >=7.0.0
- composer-plugin-api: ^1.1|^2.0
- ext-json: *
- laravel/framework: ~5.5|~6|~7
- wikimedia/composer-merge-plugin: dev-feature/composer-v2 as 1.5.x-dev
README
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
\_ Providers
\_ 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.