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

Laravel Blade Javascript Laravel Package

spatie/laravel-blade-javascript

Adds a simple @javascript Blade directive to export PHP values to JavaScript by writing them to window in a script tag. Use @javascript('key','value') and access it in the browser as key/value for quick server-to-client data sharing.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enables quick export of server-side data to client-side JavaScript, eliminating need for manual script injection or custom API endpoints for simple data transfers.
  • Ideal for server-rendered applications where frontend JS requires initial state (e.g., user data, config settings) without additional HTTP requests.
  • Supports "buy" decision over building in-house solution due to Spatie's maintenance, active updates, and security features like string escaping.
  • Reduces technical debt by providing a standardized, tested method for PHP-to-JS data sharing, improving team productivity and consistency across projects.

When to Consider This Package

  • Adopt when your project uses Blade templates and needs to pass simple, non-sensitive data to client-side scripts (e.g., authentication tokens, UI configuration).
  • Use when avoiding unnecessary API endpoints for small data transfers, especially in traditional server-side rendered apps.
  • Consider alternatives if using a modern frontend framework (React/Vue) with separate build processes, or if requiring complex data structures/real-time updates (use WebSockets or REST API instead).
  • Avoid if handling sensitive data without proper sanitization; ensure data is properly escaped (the package handles this, but PM must enforce data sanitization policies).

How to Pitch It (Stakeholders)

  • Executives: "Spatie's Laravel Blade JavaScript package streamlines data flow between server and client, reducing development time by up to 30% for features requiring server-side data in JavaScript. Backed by a trusted open-source team with rigorous maintenance,
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.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope