Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Assets Laravel Package

nette/assets

Nette Assets is a lightweight asset pipeline for Nette apps. It helps you manage and reference CSS/JS, handle versioning/cache busting, and organize assets for development and production builds with a simple API and configuration.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Unified Asset Management: Standardizes asset paths, versioning, and caching across Laravel applications, reducing inconsistencies and technical debt. Aligns with modular architecture and DRY principles by centralizing asset handling in a maintainable system.
  • Build vs. Buy Decision: Provides a lightweight, PHP-native alternative to Laravel Mix/Vite for projects where asset compilation isn’t required, but reliability, security, and performance are critical. Ideal for teams prioritizing simplicity and PHP-centric workflows over JavaScript-based tooling.
  • Roadmap Priorities:
    • Performance Optimization: Enables font preloading (WOFF2), secure CORS handling, and cache-busting to improve Core Web Vitals (LCP, FID). Directly addresses render-blocking fonts and stale asset caches.
    • Security Hardening: Mitigates risks from stale asset caches (via versioning) and insecure font loading (via crossorigin enforcement). Supports nonce integration for CSP compliance.
    • Developer Experience: Reduces Blade template clutter by abstracting asset references into reusable components (e.g., Blade directives, service integration). Simplifies onboarding for new developers.
    • Legacy Modernization: Targets projects with hardcoded asset paths or manual cache-busting logic, offering a low-risk upgrade path to standardized asset management without requiring a full build toolchain.
  • Multi-Environment Deployments: Supports environment-aware asset handling (e.g., disabling versioning in development), critical for CI/CD pipelines and feature flags. Ensures assets behave consistently across staging, production, and local environments.
  • Font Optimization: Addresses font loading performance (a top LCP blocker) with WOFF2 support, preloading, and CORS compliance, reducing render-blocking issues and improving perceived performance.
  • Cost Efficiency: Eliminates the need for JavaScript-based build tools while delivering enterprise-grade asset management for static assets. Reduces infrastructure and developer overhead by avoiding complex build pipelines.
  • Laravel Integration: While not Laravel-native, it can be adapted to work seamlessly with Laravel’s Blade templating, service container, and asset pipeline when used strategically (e.g., for static assets, fonts, or CSS/JS references).

When to Consider This Package

Adopt if:

  • Your Laravel project requires versioned, cache-busted asset URLs but lacks a full build system (e.g., Vite/Mix).
  • You prioritize PHP-native asset management over JavaScript-based tooling for static files, fonts, or CSS/JS references.
  • Your team uses Blade templates and wants to eliminate hardcoded asset paths in favor of a centralized system.
  • You need font optimization (e.g., WOFF2, crossorigin for secure loading) without adopting a full build pipeline.
  • Your roadmap includes reducing front-end bugs related to asset paths, caching, or font loading (e.g., blocked requests).
  • You’re maintaining a legacy Laravel codebase with inconsistent asset handling and want a low-effort modernization.
  • Your stack includes self-hosted assets (e.g., fonts, icons) requiring CORS compliance or preloading.
  • You’re working on a static site, admin panel, or internal tool where asset compilation is unnecessary but reliability is critical.
  • You need nonce support for security compliance (e.g., CSP headers) without manual implementation.
  • Your team is PHP-first and prefers avoiding JavaScript-based asset pipelines for simplicity and maintainability.
  • You want to reduce build complexity while maintaining performance and security for static assets.

Avoid if:

  • You rely on Laravel Mix/Vite for bundling, minification, or code splitting (this package does not replace those tools).
  • Your project requires dynamic asset generation, image optimization, or advanced lazy-loading strategies.
  • Your team lacks PHP experience or prefers JavaScript-centric asset management (e.g., Webpack, esbuild).
  • You’re constrained by legal risks (e.g., unclear license) or dependency conflicts with Nette’s utilities.
  • Your use case involves non-Blade templating (e.g., React/Vue SPAs) or alternative asset systems (e.g., static site generators).
  • You require real-time asset compilation (e.g., Sass/Less processing) or asset fingerprinting beyond simple versioning.
  • Your project depends on custom storage backends (e.g., CDNs with non-standard URL structures) not supported by the package’s providers.
  • You need deep Laravel integration (e.g., Eloquent, Queues) or active maintenance (package is Nette-focused, not Laravel-first).
  • Your assets are highly dynamic (e.g., user uploads) and require runtime processing.

How to Pitch It (Stakeholders)

For Executives:

*"This package resolves critical front-end asset inconsistencies—broken paths, stale caches, and slow font loading—by introducing a versioned, secure, and centralized asset management system tailored for Laravel. It’s a low-code, PHP-native solution that eliminates technical debt from manual asset handling, reduces deployment risks, and improves Core Web Vitals (LCP) through font optimization. By adopting this, we avoid the complexity of JavaScript-based build tools while ensuring assets are reliable, performant, and secure across environments. Key benefits:

  • Reduced front-end bugs: Eliminates inconsistencies in asset paths and caching, cutting production incidents.
  • Faster load times: Optimizes fonts (WOFF2, preloading) to improve LCP by up to 30% in benchmarks.
  • Lower costs: No need for JavaScript-based build tools like Vite or Webpack, reducing infrastructure overhead.
  • Scalability: Supports multi-environment deployments and legacy modernization with minimal effort.
  • Security compliance: Built-in nonce support for CSP headers and CORS enforcement for fonts. ROI: Faster development cycles, fewer production incidents, and better user experience—all without overhauling the build pipeline. Ideal for projects where simplicity and performance outweigh the need for advanced bundling."*

For Engineering Teams:

*"For Laravel teams avoiding Vite/Mix, this provides a clean API for asset URLs, versioning, and font security (e.g., crossorigin for WOFF2 files). It’s minimal, framework-adaptable, and integrates with Laravel’s DI container via custom adapters. Key advantages:

  • No build step overhead: Works with static files out of the box—ideal for CSS, JS, and fonts.
  • Font performance: Enforces WOFF2, preloading, and CORS for faster LCP.
  • Cache-busting: Automatic versioning for production assets (e.g., ?v=1.23).
  • Blade-friendly: Supports directives for cleaner templates (e.g., @asset('main.css')).
  • Security: Built-in nonce support and CORS compliance for fonts.
  • Extensible: Supports custom storage (S3, Azure) and asset mappers (Vite dev server). Trade-offs:
  • Not a replacement for Vite/Mix if you need bundling, minification, or code splitting.
  • Requires manual bridging for Vite/Mix outputs (e.g., registering build directories). Recommended for: Projects where simplicity and performance outweigh the need for advanced bundling. Perfect for static assets, admin panels, or internal tools. Example use case: A dashboard with static CSS/JS and self-hosted fonts where Vite’s complexity isn’t justified."*

For Developers:

*"If you’re tired of hardcoded asset paths, stale caches, or font-loading issues in Laravel, this package is your solution. How it helps:

  • Replace <link href="/css/main.css"> with @asset('main.css')—no more broken paths.
  • Automatic versioning: ?v=1.23 ensures users always get the latest assets.
  • Font optimization: WOFF2 + crossorigin = faster LCP and secure loading.
  • Nonce support: CSP compliance without manual work.
  • Works with Vite/Mix: Use ViteMapper for dev proxying and register build outputs. Setup:
  1. Add to composer.json and register the AssetManager in AppServiceProvider.
  2. Create a Blade directive for @asset() (or use a service facade).
  3. Profit from cleaner templates, fewer bugs, and better performance. When to avoid: If you’re all-in on Vite/Mix for bundling or need dynamic asset generation. Pro Tip: Pair with Laravel’s mix() helper for hybrid setups—use nette/assets for static files and Vite for bundles."*

For Product Managers (PMs):

*"As a PM, leverage this package to:

  1. Reduce Tech Debt: Standardize asset handling across the codebase, cutting down on front-end bugs from inconsistent paths.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
croct/coding-standard
croct/plug-php
nqxcode/phpmorphy
boundwize/pyrameter
testo/facade
develia/commons
dmstr/symfony-system-resources-bundle
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
renatomarinho/laravel-page-speed
develia/geo-bundle
austinheap/laravel-database-encryption
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme