Code Monkey home page Code Monkey logo

onfido-php's Introduction

Onfido PHP Library

The official PHP library for integrating with the Onfido API.

Documentation can be found at https://documentation.onfido.com.

This version uses Onfido API v3.6. Refer to our API versioning guide for details of which client library versions use which versions of the API.

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

Installation

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/onfido/onfido-php.git"
    }
  ],
  "require": {
    "onfido/onfido-php": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$configuration = Onfido\Configuration::getDefaultConfiguration();
$configuration->setApiToken($_ENV['ONFIDO_API_TOKEN']);
$configuration->setRegion(Onfido\Region::EU);   // Supports `EU`, `US` and `CA`

$onfidoApi = new Onfido\Api\DefaultApi(
              new \GuzzleHttp\Client([
                  'timeout'  => 30,
                  'connect_timeout' => 30,
                  'read_timeout' => 30
              ]), $configuration);

Making a call to the API

try {
  $applicant = $onfidoApi->createApplicant(
      new Onfido\Model\ApplicantBuilder(
          [
              'first_name' => 'First',
              'last_name' => 'Last'
          ])
  );

  // To access the information use the getter for the desired property on the object, for example:
  $applicant->getFirstName();

  // ...

} catch (Onfido\ApiException $ex) {
  // Handle API exception
  echo 'Caught exception: ',  $ex->getMessage(), "\n";
}

Webhook event verification

Webhook events payload needs to be verified before it can be accessed. Library allows to easily decode the payload and verify its signature before returning it as an object for user convenience:

try {
  $verifier = new Onfido\WebhookEventVerifier('_ABC123abc...3ABC123_');

  $signature = 'a0...760e';

  $event = $verifier->readPayload('{"payload":{"r...3"}}', $signature);
} catch (Onfido\OnfidoInvalidSignatureError $ex) {
  // Invalid webhook signature
}

Contributing

This library is automatically generated using OpenAPI Generator - version: 7.5.0; therefore all the contributions, except tests files, should target Onfido OpenAPI specification repository instead of this repository.

For contributions to the tests instead, please follow the steps below:

  1. Fork repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create a new Pull Request

More documentation

More documentation and code examples can be found at https://documentation.onfido.com.

Support

Should you encounter any technical issues during integration, please contact Onfido's Customer Support team via the Customer Experience Portal which also includes support documentation.

onfido-php's People

Contributors

andrevalentin avatar chrisbulloz avatar ciaran16 avatar davidmealha avatar davidmealha-onfido avatar developer88 avatar dvacca-onfido avatar joaogoncalves-onfido avatar lukasjuhas avatar phoebe-b avatar ra-ul avatar serbioboeronfido avatar thelevti avatar thisilvafarias avatar wouterj avatar zoeradkani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.