PHP code example of yidas / client-ip

1. Go to this page and download the library: Download yidas/client-ip library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yidas / client-ip example snippets


echo ClientIP::get();
ClientIP::config([
    'proxyIPs' => ['192.168.0.0/16', '172.217.3.11'],
    'headerKeys' => ['HTTP_X_FORWARDED_FOR']
    ]);
echo ClientIP::get();

ClientIP::config([
    'proxyIPs' => true
    ]);

ClientIP::config([
    'proxyIPs' => ['0.0.0.0/32']
    ]);

ClientIP::config([
    'proxyIPs' => ['172.217.3.11']
    ]);


ClientIP::config([
   'proxyIPs' => ['192.168.0.0/16']
   ]);

ClientIP::config([
   'proxyIPs' => ['192.168.0.0/16', '172.217.2.89'],
   'headerKeys' => ['HTTP_X_FORWARDED_FOR'],
   ]);