nhymxu / php-floc-disable
PHP middleware to disable Google's Federated Learning of Cohorts (FLoC) tracking
Fund package maintenance!
Ko Fi
www.paypal.me/nhymxu
nhantien.momo.vn/WTOl9cURX5P
Requires
- php: ^7.3 || ^8.0
- psr/http-server-middleware: ^1
Requires (Dev)
- nyholm/psr7: ^1.4
- phpunit/phpunit: ^8|^9
- roave/security-advisories: dev-latest
README
PHP middleware to disable Google's Federated Learning of Cohorts (FLoC
) tracking
Usage
This package is installable and auto-loadable via Composer as nhymxu/php-floc-disable.
composer require nhymxu/php-floc-disable
Slim 4 integration
Add the FlocDisableMiddleware
to set the header
Example: public/index.php
<?php use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Nhymxu\FlocDisable\FlocDisableMiddleware; use Slim\Factory\AppFactory; require_once __DIR__ . '/../vendor/autoload.php'; $app = AppFactory::create(); // Add Slim routing middleware $app->addRoutingMiddleware(); // Set the header to disable FLoC. $app->add(new FlocDisableMiddleware()); $app->addErrorMiddleware(true, true, true); // Define app routes $app->get('/', function (Request $request, Response $response) { $response->getBody()->write('Hello, World!'); return $response; })->setName('root'); // Run app $app->run();
Support
- Issues: https://github.com/nhymxu/php-floc-disable/issues
- Here you can donate for this project.
License
The MIT License (MIT). Please see License File for more information.