Cms: Being able to use vendor:publish for addon config files

Created on 24 Sep 2019  Â·  8Comments  Â·  Source: statamic/cms

Like you can use the php artisan vendor:publish command to push addon assets, there's no way when creating a Statamic addon to set configuration files that can be published.

enhancement

Most helpful comment

Put it in the root. We use a directory because we have multiple files and didn’t want to clog the root. But we can’t stop you from putting them wherever you want.

All 8 comments

I thought I found a solution for it but it didn't end up working.

Good find, there's no Statamicy way to do it. But you can still do it the Laravel way.

function boot()
{
    parent::boot();

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

@damcclean Do you publish your addon config into the config/statamic subfolder or simply into config? I'm thinking config/statamic makes more sense. Especially when installing Statamic into an existing Laravel app. This way all the Statamic related configs are sorted.

@damcclean Do you publish your addon config into the config/statamic subfolder or simply into config? I'm thinking config/statamic makes more sense. Especially when installing Statamic into an existing Laravel app. This way all the Statamic related configs are sorted.

I just put them in the config folder itself.

I did think about putting it in config/statamic originally but I must have changed my mind 😂 I could always change it.

Yeah, I'm torn too. I'm just thinking that it would be great if all addons followed the same pattern …

Yeah I agree. I was probably just waiting to see what others were going to do.

Put it in the root. We use a directory because we have multiple files and didn’t want to clog the root. But we can’t stop you from putting them wherever you want.

Alright! You da boss! 🤓

Was this page helpful?
0 / 5 - 0 ratings