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

jward3@email.unc.edu's avatar

using vendor:publish on packages not in vendor

I'm working on developing a package using the Workbench development workflow. I have a service provider that defines things to publish (config, migrations, etc.):

class TasksServiceProvider extends ServiceProvider {
    public function boot(){
    ...
        // Publish the config file
        $this->publishes([
            __DIR__.'/config/config.php' => config_path('tasks.php'),
        ], 'config');

        // Publish the migrations
        $this->publishes([
            __DIR__.'/migrations/' => database_path('/migrations')
        ], 'migrations');
        ...
    }
    ...
}

But when I try to publish these using

php artisan vendor:publish --provider="Name\Space\TasksServiceProvider"

I get the response "Nothing to publish."

I ideas on what I'm doing wrong?

0 likes
5 replies
bobbybouwmann's avatar

You don't specify the namespace, but you specify the vendor and package name

php artisan vendor:publish --provider="Vendor\Package\ServiceProvider"

So if your package is called laravel/laravel and your ServiceProvider LaravelServiceProvider you need to do it like this

php artisan vendor:publish --provider="Laravel\Laravel\LaravelServiceProvider"
3 likes
jward3@email.unc.edu's avatar

In this case the namespace and the Vendor\Package are the same thing. Sorry for the confusion.

Here's the actual command I'm running

php artisan vendor:publish --provider="Sirs/Task/TasksServiceProvider"

Where Sirs is the vendor and Tasks is the package.

I should note that artisan appears to be finding the provider just fine. It just doesn't think there's anything to publish.

bobbybouwmann's avatar
Level 88

Aaah oke, well this should work though! Are you sure the files are not created yet?

jward3@email.unc.edu's avatar

Confirmed that the files didn't already exist in /app and ran it again. Strangely enough, it seems to be working now.

Not sure what shook loose in the interim.

Thanks for your help @blackbird!

Please or to participate in this conversation.