taylornetwork/cloudflare-ip-laravel is a Laravel package.
It currently has 1 GitHub stars and 54 downloads on Packagist.
Install it with composer require taylornetwork/cloudflare-ip-laravel.
Discover more Laravel packages by taylornetwork
or browse all Laravel packages to compare alternatives.
Last updated
If you use Cloudflare, this will set $_SERVER['REMOTE_ADDR'] to $_SERVER['HTTP_CF_CONNECTING_IP'] if it's set.
Using Composer
$ composer require taylornetwork/cloudflare-ip-laravel
And then run
$ php artisan cf:install
You don't even need to install this package if you'd rather just edit your public/index.php yourself.
Just add the following after $app = require_once __DIR__.'/../bootstrap/app.php';
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}