Assets

Assets

If the package requires assets in the views/view-components, these must be published. Otherwise, the package assets(css/js/images) cannot be included in the html of the laravel website.

bootraiser expects the package assets under laravel-installation/packages/your-package/public

<?php
namespace YourCompany\YourPackage\Providers;

use Filefabrik\Bootraiser\Raiser;
use Illuminate\Support\ServiceProvider;

class YourPackageServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        Raiser::forProvider($this)->publishAssets();
    }
}

publishing command

If your package requires assets, enter the artisan publishing command in your package doc or readme.md

php artisan vendor:publish --tag=your-package-assets

References

https://laravel.com/docs/11.x/packages#public-assets

Last updated on