Reputation: 103
forgive me my poor English.I am a newbie to Laravel. I made a blog project with laravel 5.5 . The project includes packages that wrote by other people.There is one package that need to execute php artisan vendor:publish command after installed with composer.I have uploaded my project to github. When other people install my project, I want them to install my project without running the vendor:publish command . How can I do that? Thank you
Upvotes: 2
Views: 2301
Reputation: 7509
Generate a new command which runs all other command that you need to run in order to bootstrap your project including other packages vendor command.
A bootstrap ommand like:
php artisan make:command bootMyProject
dispatch events at the end of the general command and use the events to trigger others commands.
Upvotes: 0
Reputation: 1104
You can add the command to your composer.json
file under scripts
section.
For example, you want artisan vendor:publish
to run automatically after composer install
you can add it to post-install-cmd
"scripts": {
...
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize",
"php artisan vendor:publish"
],
...
},
You can check composer document for detail
Upvotes: 5