Skip to content

Vivify-Ideas/regzen-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Regzen PHP Library

This library provides a simple interface for communicating with the Regzen API.

Documentation

Installation

The preferred method of installing this library is with Composer by running the following from your project root:

$ composer require regzen/regzen-php

Usage

Instantiating the client

Instantiate the client with your application secret:

$regzen = new \Regzen\RegzenClient('YOUR_APPLICATION_SECRET');

Note: You should not keep your application secret in your source code, but rather retrieve it as the value of an environment variable.

Exchanging the authorization code

Exchange the authorization code by calling exchangeAuthorizationCode on the client:

$response = $this->regzen->exchangeAuthorizationCode($authorizationCode);

You can later acces the user data like this:

$email = $response->data->email;

If the exchange fails, a \Regzen\RegzenUnauthorizedException will be thrown which you can catch and show the user appropriate feedback.

Decrypting data

When communicating with the Regzen API, you'll need to decrypt received data before any further use. Decrypt payload by calling decryptPayload on the client:

$payload = $this->regzen->decryptPayload($encryptedPayload);

You can later acces the payload data like this:

$fieldName = $payload->data->field_name;

If the decryption fails, a \Regzen\RegzenUnauthorizedException will be thrown which you can catch and show the user appropriate feedback.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%