-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5c8c609
Showing
10 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
preset: laravel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Laravel No FLoC | ||
|
||
[![Latest Version on Packagist][ico-version]][link-packagist] | ||
[![Total Downloads][ico-downloads]][link-downloads] | ||
[![Build Status][ico-travis]][link-travis] | ||
[![StyleCI][ico-styleci]][link-styleci] | ||
|
||
This package will add the `Permissions-Policy: interest-cohort=()` to try and twart Google's usage of your site in it's FLoC tracking method. | ||
|
||
**That being said, it might not be a foolproof method.** See [Seirdly.one's post](https://seirdy.one/2021/04/16/permissions-policy-floc-misinfo.html) to get to know why it might work well, why it might not. | ||
|
||
## Installation & usage | ||
|
||
Via Composer | ||
|
||
``` bash | ||
$ composer require jpmurray/laravel-nofloc | ||
``` | ||
|
||
That's all. The header will be added to all request via a global middleware. | ||
|
||
## Change log | ||
|
||
Please see the [changelog](changelog.md) for more information on what has changed recently. | ||
|
||
## Contributing | ||
|
||
Please see [contributing.md](contributing.md) for details and a todolist. | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email author email instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [Jean-Philippe Murray][https://github.com/jpmurray] | ||
- [All Contributors][link-contributors] | ||
|
||
## License | ||
|
||
license. Please see the [license file](license.md) for more information. | ||
|
||
[ico-version]: https://img.shields.io/packagist/v/jpmurray/laravel-nofloc.svg?style=flat-square | ||
[ico-downloads]: https://img.shields.io/packagist/dt/jpmurray/laravel-nofloc.svg?style=flat-square | ||
[ico-travis]: https://img.shields.io/travis/jpmurray/laravel-nofloc/master.svg?style=flat-square | ||
[ico-styleci]: https://styleci.io/repos/12345678/shield | ||
|
||
[link-packagist]: https://packagist.org/packages/jpmurray/laravel-nofloc | ||
[link-downloads]: https://packagist.org/packages/jpmurray/laravel-nofloc | ||
[link-travis]: https://travis-ci.org/jpmurray/laravel-nofloc | ||
[link-styleci]: https://styleci.io/repos/12345678 | ||
[link-author]: https://github.com/jpmurray | ||
[link-contributors]: ../../contributors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Changelog | ||
|
||
All notable changes to `LaravelNoFLoC` will be documented in this file. | ||
|
||
## Version 1.0 | ||
|
||
### Added | ||
- A global middleware to add the specified header. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "jpmurray/laravel-nofloc", | ||
"description": "Adds a header response that should be opting out your site from being used for Google's FloC tracking.", | ||
"license": "license", | ||
"authors": [ | ||
{ | ||
"name": "Jean-Philippe Murray", | ||
"email": "[email protected]", | ||
"homepage": "https://atomescroch.us" | ||
} | ||
], | ||
"homepage": "https://github.com/jpmurray/laravel-nofloc", | ||
"keywords": ["Laravel", "FLoC", "privacy"], | ||
"require": { | ||
"illuminate/support": "~7|~8" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "~9.0", | ||
"orchestra/testbench": "~5|~6" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"jpmurray\\LaravelNoFLoC\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"jpmurray\\LaravelNoFLoC\\Tests\\": "tests" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"jpmurray\\LaravelNoFLoC\\LaravelNoFLoCServiceProvider" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
// | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Contributing | ||
|
||
Contributions are welcome and will be fully credited. | ||
|
||
Contributions are accepted via Pull Requests on [Github](https://github.com/jpmurray/laravel-nofloc). | ||
|
||
# Things you could do | ||
If you want to contribute but do not know where to start, this list provides some starting points. | ||
- Add license text | ||
- Set up tests | ||
- Set up TravisCI, StyleCI, ScrutinizerCI | ||
|
||
## Pull Requests | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `readme.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. | ||
|
||
|
||
**Happy coding**! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# The license | ||
|
||
Copyright (c) author name <author email> | ||
|
||
...Add your license text here... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Package"> | ||
<directory suffix=".php">./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory>src/</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace jpmurray\LaravelNoFLoC; | ||
|
||
use Illuminate\Contracts\Http\Kernel; | ||
use Illuminate\Support\ServiceProvider; | ||
use jpmurray\LaravelNoFLoC\Middleware\NoFLoCMiddleware; | ||
|
||
class LaravelNoFLoCServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Perform post-registration booting of services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot(): void | ||
{ | ||
$kernel = $this->app->make(Kernel::class); | ||
$kernel->pushMiddleware(NoFLoCMiddleware::class); | ||
} | ||
|
||
/** | ||
* Register any package services. | ||
* | ||
* @return void | ||
*/ | ||
public function register(): void | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace jpmurray\LaravelNoFLoC\Middleware; | ||
|
||
use Closure; | ||
|
||
class NoFLoCMiddleware | ||
{ | ||
public function handle($request, Closure $next) | ||
{ | ||
$response = $next($request); | ||
|
||
$response->header('Permissions-Policy', 'interest-cohort=()'); | ||
|
||
return $response; | ||
} | ||
} |