PHP client library for ipify: A Simple IP Address API.
Latest commit dc5f1bc Mar 15, 2016 Benjamin Smith stable release
Failed to load latest commit information.
src initial commit Jun 11, 2015
.editorconfig initial commit Jun 11, 2015
.travis.yml initial commit Jun 11, 2015
composer.json fix typo in package name Jun 11, 2015
phpunit.xml.dist initial commit Jun 11, 2015


Software License Build Status Quality Score

This library will retrieve your public IP address from ipify's API service, and return it as a string.

This library also has some other nice features you might care about:

  • This library handles exceptions properly, and usage examples below show you how to deal with errors in a foolproof way.
  • This library only makes API requests over HTTPS.


Via Composer

$ composer require benjamin-smith/php-ipify


echo Ipify\Ip::get();

Or, if your inclined to catch any errors:

try {
    $ip = Ipify\Ip::get();    
} catch (ConnectionError $e) {
    // If you get here, it means you were unable to reach the ipify service,
    // most likely because of a network error on your end.
} catch (ServiceError $e) {
    // If you get here, it means ipify is having issues, so the request
    // couldn't be completed :(
} catch (Exception $e) {
    // Something else happened (non-ipify related).

Change log

Please see CHANGELOG for more information what has changed recently.


$ vendor/bin/phpunit


Please see CONTRIBUTING for details.


If you discover any security related issues, please email instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.