esign / laravel-install-command
Simplify stub publishing and effortlessly manage Composer and Node packages
1.1.0
2024-03-12 22:20 UTC
Requires
- php: ^8.1
- illuminate/console: ^10.0|^11.0
- illuminate/filesystem: ^10.0|^11.0
- illuminate/process: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^9.0|^10.0
This package is auto-updated.
Last update: 2024-11-20 20:01:02 UTC
README
This package provides a simple way to publish stubs and install Composer and Node packages using a Laravel Command. This may be useful when creating packages that require stubs to be publish and require Composer and Node packages to be installed.
Installation
You can install the package via composer:
composer require esign/laravel-install-command
Usage
To make use of the InstallJob you may create a new command that extends the InstallCommand class. In this command you may specify the stubs to publish and the Composer and Node packages to install.
use Esign\InstallCommand\InstallCommand; use Esign\InstallCommand\ValueObjects\AppendableFile; use Esign\InstallCommand\ValueObjects\ComposerPackage; use Esign\InstallCommand\ValueObjects\NodePackage; use Esign\InstallCommand\ValueObjects\PublishableFile; class MyInstallCommand extends InstallCommand { protected $signature = 'my-install-command'; protected $description = 'Publish my stubs and install my packages'; protected function publishableFiles(): array { return [ new PublishableFile( path: __DIR__ . '/../../stubs/my-stub.stub', target: base_path('my-stub.php'), ), new AppendableFile( path: __DIR__ . '/../../stubs/my-appendable-stub.stub', target: base_path('my-appendable-stub.php'), ), new AppendableFile( path: __DIR__ . '/../../stubs/my-appendable-stub.stub', target: base_path('my-appendable-stub.php'), search: 'insert-after-line-with-this-string', ), ]; } protected function composerPackages(): array { return [ new ComposerPackage(name: 'my/composer-package'), new ComposerPackage(name: 'my/specific-composer-package', version: '^1.0'), new ComposerPackage(name: 'my/dev-composer-package', dev: true), ]; } protected function nodePackages(): array { return [ new NodePackage(name: 'my/node-package'), new NodePackage(name: 'my/specific-node-package', version: '^1.0'), new NodePackage(name: 'my/dev-node-package', dev: true), ]; } }
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.