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 Disable Floc

Laravel Disable Floc Laravel Package

spatie/laravel-disable-floc

Automatically disables Google’s FLoC in Laravel apps by adding a Permissions-Policy header. Installs via Composer and works out of the box—no configuration needed. Applies the header to responses that don’t already set Permissions-Policy.

View on GitHub
Deep Wiki
Context7

Automatically disable Google's FLoC in Laravel apps

Frequently asked questions about Laravel Disable Floc
How do I install spatie/laravel-disable-floc in my Laravel project?
Run `composer require spatie/laravel-disable-floc` in your project root. The package auto-registers the middleware in Laravel’s web group, so no additional steps are needed unless you want customization.
Does this package work with Laravel 10 or newer?
The package was last updated in 2022 and may not officially support Laravel 10+. Test thoroughly in a staging environment, as middleware behavior can vary across major Laravel versions.
Can I disable FLoC only for specific routes in my Laravel app?
Yes, use Laravel’s middleware grouping. Wrap routes in `Route::middleware(DisableFloc::class)->group(function () { ... })` to apply it selectively.
Is this package still relevant since Google deprecated FLoC?
While FLoC is deprecated, this package may still help block legacy tracking or serve as a placeholder for future privacy controls. For modern alternatives, consider Topics API opt-outs or Permissions-Policy headers.
Will this package interfere with other middleware like CORS or security headers?
The middleware injects a `Permissions-Policy` header. Ensure it runs *after* other header-modifying middleware (e.g., `TrustProxies`, `ShareHeaders`) in your stack to avoid conflicts.
How do I verify FLoC is disabled after installation?
Use Chrome DevTools to check the `Permissions-Policy` header in responses. Tools like [FLoC Detection](https://github.com/am i flocced) or Chrome’s `chrome://flags/#privacy-sandbox` can confirm the opt-out.
Does this package support Laravel Lumen or Forge/Valet deployments?
Yes, the package works with Lumen and is compatible with Forge/Valet. Register the middleware in your Lumen `bootstrap/app.php` or Laravel’s `AppServiceProvider` as usual.
Are there alternatives to this package for broader privacy controls?
For comprehensive privacy, combine this with packages like `spatie/laravel-activitylog` (audit trails) or `spatie/laravel-honeypot` (bot protection). For modern tracking, explore `spatie/laravel-permissions-policy`.
Will disabling FLoC break any existing ad-targeting or analytics?
FLoC was rarely adopted, but if your app relies on Google’s experimental tracking, test thoroughly. This package *only* disables FLoC—other trackers (e.g., Google Analytics) remain unaffected.
Is there a way to customize the Permissions-Policy header beyond disabling FLoC?
The package doesn’t expose direct customization, but you can publish its config (if available) or manually override the middleware in `app/Http/Middleware/DisableFloc.php` to extend the header.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport