Coder Social home page Coder Social logo

greipio / php Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 56 KB

The official PHP Library for Greip API.

Home Page: https://greip.io

License: Apache License 2.0

PHP 100.00%
geoip geolocation-api gelocation api country-data php credit-card-fraud bin-lookup asn-lookup fraud-detection

php's Introduction

Greip PHP Library

The official PHP library for Greip API

Report Issue · Request Feature · Greip Website · Documentation

Packagist Github Repository

Packagist Version    GitHub code size in bytes    API Status    License: Apache 2.0    Packagist PHP Version Support


Installation

composer require gre/geoip

Usage

Here's how you use the library:

1. IP Geolocation

Use this method to retrieve the information of a given IP address.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$GeoIP = new Greip\API\GeoIP();

// Setting the API Key
$config->setToken("<API-Key>");

// Sending the request and storing the output in a variable
$GeoIP_Response = $GeoIP->lookup("1.1.1.1");

// Printing the response
print_r($GeoIP_Response);

2. IP Threats

Use this method to retrieve threat intelligence information associated with a given IP address.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$GeoIP = new Greip\API\GeoIP();

// Setting the API Key
$config->setToken("<API-Key>");

// Sending the request and storing the output in a variable
$GeoIP_Response = $GeoIP->threats("1.1.1.1");

// Printing the response
print_r($GeoIP_Response);

3. ASN Lookup

In this method, Greip will help you lookup any given AS Number and returning all data related to it, like: name, org (the organization name), country, domain, email, phone, totalIPs, list of all routes (v4 & v6) related the given AS Number, etc.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$GeoIP = new Greip\API\GeoIP();

// Setting the API Key
$config->setToken("<API-Key>");

// Sending the request and storing the output in a variable
$ASN_Response = $GeoIP->asn("AS01");

// Printing the response
print_r($ASN_Response);

4. Country Lookup

This method can help you retrieve information of the given country.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$GeoIP = new Greip\API\GeoIP();

// Setting the API Key
$config->setToken("<API-Key>");

// Sending the request and storing the output in a variable
$Country_Response = $GeoIP->country("US", ["language", "timezone", "currency"]);

// Printing the response
print_r($Country_Response);

5. Email Validation

This method provides an additional layer of validation for your system. While validating email syntax is important, it is not sufficient.

This method goes beyond syntax validation by checking the domain’s validity, the availability of the Mail Service, detecting Disposable Email (Temporary Emails), etc. By utilising this method, you can ensure a more thorough validation process for email addresses.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();

// Setting the API Key
$config->setToken("<API-Key>");

// Sending the request and storing the output in a variable
$Email_Response = $Fraud->email("[email protected]");

// Printing the response
print_r($Email_Response);

6. Phone Validation

This method can be used as an extra-layer of your system for validating phone numbers. It validates phone number syntax and valid-possibility.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();

// Setting the API Key
$config->setToken("<API-Key>");

// Sending the request and storing the output in a variable
$Phone_Response = $Fraud->phone("000000000", "US");

// Printing the response
print_r($Phone_Response);

7. Profanity Detection

This method can be used to detect abuse of your website/app. It’s a great way to know more about your user inputs and whether they contain profanity (bad words) or not before releasing them to the public.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();

// Setting the API Key
$config->setToken("<API-Key>");

// Sending the request and storing the output in a variable
$Profanity_Response = $Fraud->profanity("This is a sample text", true, false);

// Printing the response
print_r($Profanity_Response);

8. Payment Fraud Prevention

Prevent financial losses by deploying AI-Powered modules.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();

// Setting the API Key
$config->setToken("<API-Key>");

// Declaring Transaction Data
$data = [
  "action" => "purchase",
  "website_domain" => "example.com",
  "merchant_id" => 21,
  "customer_id" => 1,
  "customer_ip" => "1.0.0.2",
  "customer_email" => "[email protected]",
  "customer_phone" => "32423434",
  "customer_country" => "US",
  "transaction_amount" => 100000,
  "transaction_currency" => "USD",
  "customer_useragent" => "Mozill almaden sdfwer",
];

// Sending the request and storing the output in a variable
$Payment_Response = $Fraud->payment($data);

// Printing the response
print_r($Payment_Response);

9. IBAN Validation

This method allows you to validate International Bank Account Numbers (IBANs) and retrieve additional information about the country associated with the IBAN.

include_once __DIR__ . "/vendor/autoload.php";

// Declaring the classes we need
$config = new Greip\API\Config();
$Fraud = new Greip\API\Fraud();

// Setting the API Key
$config->setToken("<API-Key>");

// Sending the request and storing the output in a variable
$IBAN_Response = $Fraud->iban("FO9264600123456789");

// Printing the response
print_r($IBAN_Response);

Options, Methods and More

You can find the full guide of this package by visiting our Documentation Page.

Credits

php's People

Contributors

gre-dev avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.