Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

socieboy's avatar

php artisan vendor:publish

I there! I have a package that require to publish the assets but I just want to publish some assets if the User doesn't specify others. Example I have to publish the config file which is required, but maybe they not need to publish the views of the package, so I would like to do something like

php artisan vendor:publish --config
php artisan vendor:publish --views

There is some way to do that?

0 likes
6 replies
mstnorris's avatar

@socieboy I'm not sure if this is currently possible, maybe others will chime in.

php artisan help vendor:publish

Usage:
 vendor:publish [--force] [--provider[="..."]] [--tag[="..."]]

Options:
 --force               Overwrite any existing files.
 --provider            The service provider that has assets you want to publish.
 --tag                 The tag that has assets you want to publish.
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question
 --env                 The environment the command should run under.
1 like
bobbybouwmann's avatar
Level 88

Of course you can do this! It's even in the documentation: http://laravel.com/docs/5.0/packages#public-assets

The idea is that you give a tag to it and the user can decide to publish it by tag or not.

// Tag here is config

$this->publishes([
    __DIR__.'/../config/package.php' => config_path('package.php')
], 'config'); 

Now you can do this

php artisan vendor:publish --tag=config
6 likes

Please or to participate in this conversation.