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

randm's avatar
Level 6

php artisan vendor:publish is not doing anything!

I am trying to execute php artisan vendor:publish for a specific vendor. But the command keep giving me Nothing to publish for tag [].

I don't understand why this command does not give you better info.

Here is the exact command

php artisan vendor:publish --provider="CrestApps\\CodeGenerator\\CodeGeneratorServiceProvider"

I actually went into CrestApps\\CodeGenerator\\CodeGeneratorServiceProvider and var dumped a message in the boot() method and I got that message. So the correct service provider is being called.

This is the code from my service provider


<?php

namespace CrestApps\CodeGenerator;

use Illuminate\Support\ServiceProvider;

class CodeGeneratorServiceProvider extends ServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Perform post-registration booting of services.
     *
     * @return void
     */
    public function boot()
    {

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

        $this->publishes([
            __DIR__ . '\\templates' => base_path('resources\\codegenerator-templates\\default'),
        ]);

    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->commands(
            'CrestApps\CodeGenerator\Commands\CreateControllerCommand',
            'CrestApps\CodeGenerator\Commands\CreateModelCommand',
            'CrestApps\CodeGenerator\Commands\CreateIndexViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateCreateViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateFormViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateEditViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateShowViewCommand',
            'CrestApps\CodeGenerator\Commands\CreateViewsCommand',
            'CrestApps\CodeGenerator\Commands\CreateLanguageCommand',
            'CrestApps\CodeGenerator\Commands\CreateFormRequestCommand',
            'CrestApps\CodeGenerator\Commands\CreateRoutesCommand',
            'CrestApps\CodeGenerator\Commands\CreateMigrationCommand',
            'CrestApps\CodeGenerator\Commands\CreateResourceCommand',
            'CrestApps\CodeGenerator\Commands\CreateViewLayoutCommand'
        );
    }
}


I validated that the file/folder that are being copied are correct and exists using scandir() and get_file_content()`

What could be causing this problem? why no files are being copied to the destination?

There is nothing in the laravel log file to also help me here.

0 likes
6 replies
ejdelmonico's avatar

Are you sure that package has publishable files? I just checked their docs and you should double check the path for publish. Try this:

php artisan vendor:publish --provider="CrestApps\laravel-codegenerator\CodeGeneratorServiceProvider"
ejdelmonico's avatar

Ok, I see the repo. Did you make the changes to config/app.php and composer dumpautoload and php artisan clearcompiled? Also, make sure the two other packages were pulled in.

randm's avatar
Level 6

Even though I have not compiled my classes yes, I executed php artisan clear-compiled and composer dumpautoload. In fact, the composer.json file of that package does composer dumpautoload after the installation or update automatically.

ejdelmonico's avatar

I realize that but if you search this forum, you will run into a huge amount of posts that result in mysterious fixes after running those two commands. That is why I suggested it. And, I have no idea what you have actually done...I can only guess.

php artisan config:clear

1 like
Darival's avatar

@ejdelmonico that actually solved my problem with Spatie\Tags\TagsServiceProvider, Why did I not try this 4 hours ago? T.T

Please or to participate in this conversation.