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

pedroroccon's avatar

Error when executing "php artisan vendor:publish" - Laravel 5.5, package development

Hello everyone. First of all, thanks for help me!

Well, I have a little project that I was doing to study. If you want to check: https://github.com/pedroroccon/hello

Its a simple template that I use in my projects. Everything was working fine, so I tried to add breadcrumbs using this package: https://github.com/davejamesmiller/laravel-breadcrumbs

So I added the instruction listed on Defining/using breadcrumbs in another package in boot method of my HelloServiceProvider. This allow my application to get the breadcrumbs in a file inside of my package. You can check it:

    public function boot()
    {
        // The following line was added to import the breadcrumbs file.
        if(class_exists('Breadcrumbs')):
            require __DIR__ . '/../routes/breadcrumbs.php';
        endif;
        

        $this->loadRoutesFrom(__DIR__ . '/../routes/routes.php');
        $this->loadViewsFrom(__DIR__ . '/../views', 'hello');
        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations/');


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


        $this->publishes([
            __DIR__ . '/../assets/' => public_path()
        ], 'hello-asset');


        $this->publishes([
            __DIR__ . '/../views/auth/' => resource_path('views/auth/')
        ], 'hello-auth');

        $this->publishes([
            __DIR__ . '/../lang/' => resource_path('lang')
        ], 'hello-lang');
    }

But now when I'm try to publish my assets with php artisan vendor:publish --tag=hello-auth (for example) the application gives me the following error:

[ErrorException]                            
array_merge(): Argument #2 is not an array  

If I remove the breadcrumbs.php from my boot method everything starts working again. Someone can tell me what I'm doing wrong?

I appreciate that! Thank you!

0 likes
0 replies

Please or to participate in this conversation.