jeffersongoncalves/laravel-amplitude
A Laravel package for integrating Amplitude analytics into your application, making it easy to configure credentials and send event tracking data from your app. A lightweight wrapper for wiring Amplitude into Laravel projects with minimal setup.
composer require <vendor>/<package>
php artisan vendor:publish --provider="<Vendor>\<Package>\<PackageServiceProvider>"
<script> rendering.Vite::useCspNonce($nonce);
As of 1.1.0, any <script> rendered by the package automatically picks up that nonce. You do not need package-specific nonce configuration if the app already sets one.{{-- layout head --}}
<x-package-script />
With script-src 'nonce-...' in place, the package output should carry the same nonce rather than requiring 'unsafe-inline'.Vite::useCspNonce(...) in middleware or a service provider that runs before the response is rendered. The package reads the nonce at render time, so ordering matters.app.blade.php or a dedicated scripts partial keeps nonce behavior consistent across pages.laravel-security-headers or similar, ensure the Content-Security-Policy header contains the same nonce value used by Vite. The package only annotates its script tags; it does not create or synchronize the response header.<script nonce="..."> match:
$response->assertHeader('Content-Security-Policy');
$response->assertSee('nonce="'.$nonce.'"', false);
npm run dev and built assets.Vite::useCspNonce(...), the script may be emitted without a nonce or with an empty one. Move nonce setup into early middleware.nonce attribute will block the script. This is the most common CSP integration failure.config:cache is fine; caching a rendered nonce is not.laravel-security-headers may have its own nonce flow. Confirm whether it reads Laravel’s Vite nonce or generates a separate one. If separate, align them explicitly; otherwise the package script and header will disagree.<script> tags still need nonce="{{ Vite::cspNonce() }}" or equivalent.'strict-dynamic' changes the failure mode. With a nonce and 'strict-dynamic', scripts loaded by a nonced script are trusted, but the initial package script still needs the correct nonce.Content-Security-Policy header for the nonce value and compare it to the script tag. Browser console CSP violations usually name the blocked script and the expected nonce.Content-Security-Policy-Report-Only to catch package scripts that are missing or mismatching nonces before enforcing.How can I help you explore Laravel packages today?