kodicms/laravel-assets
Laravel package for managing and compiling front-end assets with versioned, cache-safe URLs. Provides asset publishing, dependency handling, and Blade helpers to keep CSS and JavaScript organized in your applications.
Start by verifying the package against your Laravel/PHP version before adopting it. The last release was 2020-09-10 and the repository is not linked from the package metadata, so inspect vendor/kodicms/laravel-assets/composer.json, the service provider, facade, config file, and tests directly.
Minimal adoption path:
Install with Composer:
composer require kodicms/laravel-assets
Check whether the service provider and facade are auto-discovered. If not, register them manually in config/app.php.
Publish the config if the provider exposes a publish tag:
php artisan vendor:publish --provider="KodiCMS\\Assets\\AssetsServiceProvider"
Confirm the exact provider class and tag from vendor/kodicms/laravel-assets/src.
Register your first assets in a service provider, usually AppServiceProvider::boot() or a dedicated AssetServiceProvider:
// API names are illustrative; verify against the package facade/source.
Assets::addStyle('app', asset('css/app.css'));
Assets::addScript('app', asset('js/app.js'), ['defer']);
Render them from your main Blade layout:
<head>
{!! Assets::renderStyles() !!}
</head>
<body>
...
{!! Assets::renderScripts() !!}
</body>
The best first use case is a single layout-level asset registry: global CSS/JS in the layout, then page-specific additions from controllers or view composers.
Centralize registration in one place. Put layout-level assets in a dedicated service provider or config file. This avoids scattering asset calls across controllers and views and makes ordering easier to reason about.
Use named groups or collections. Treat the package as a small registry:
layout for global CSS/JSvendor for third-party librariespage for controller-specific assetsinline for small bootstrap/config dataRender each group in the appropriate Blade partial.
Add page assets from controllers or view composers. For example, register a page-specific stylesheet only when a given view is rendered:
View::composer('reports.*', function () {
Assets::addStyle('reports', asset('css/reports.css'));
});
Keep ordering explicit. If the package supports dependencies or priority, use them. If not, add assets in the exact order they must appear. Do not rely on registration order across multiple service providers unless you have verified it.
Wrap the package behind your own service. A small AppAssets wrapper isolates the rest of the application from the package API:
class AppAssets
{
public function addLayoutAssets(): void
{
// package calls here
}
}
This makes future replacement or forking much cheaper.
Use it as a tag registry, not a bundler. Continue using Vite, Laravel Mix, or your normal build pipeline. Give the package final URLs from asset(), Vite::asset(), or mix().
Test rendered output. In feature tests, assert that the response contains expected asset URLs and that page-specific assets do not leak into unrelated pages. This is especially important if assets are registered globally.
php artisan config:clear and php artisan view:clear when changing asset config or layout partials.asset() or secure_asset() over hardcoded /public paths so deployments behind proxies and subdirectories behave correctly.How can I help you explore Laravel packages today?