Coder Social home page Coder Social logo

gn-api-sdk-php's Introduction

SDK GERENCIANET FOR PHP

Sdk for Gerencianet Pagamentos' API. For more informations about parameters and values, please refer to Gerencianet documentation.

Build Status Code Climate Test Coverage

Installation

Require this package with composer:

$ composer require gerencianet/gerencianet-sdk-php

Or include it in your composer.json file:

...
"require": {
  "gerencianet/gerencianet-sdk-php": "1.*"
},
...

Requirements

  • PHP >= 5.4

Tested with

php 5.4 and 5.5

Getting started

Require the module and namespaces:

require __DIR__ . '/../sdk/vendor/autoload.php';

use Gerencianet\Gerencianet;

Although the web services responses are in json format, the sdk will convert any server response to array. The code must be within a try-catch and exceptions can be handled as follow:

try {
  /* code */
} catch(GerencianetException $e) {
  /* Gerencianet's api errors will come here */
} catch(Exception $ex) {
  /* Other errors will come here */
}

For development environment

Instantiate the module passing using your client_id, client_secret and sandbox equals true:

$options = [
  'client_id' => 'client_id',
  'client_secret' => 'client_secret',
  'sandbox' => true
];

$api = new Gerencianet($options);

For production environment

To change the environment to production, just set the third sandbox to false:

$options = [
  'client_id' => 'client_id',
  'client_secret' => 'client_secret',
  'sandbox' => false
];

$api = new Gerencianet($options);

Running tests

To run tests install PHPUnit and run the following command:

$ phpunit -c config.xml

Running examples

Update examples/config.json file with client_id and client_secret of your application.

You can run using any web server, like Apache or nginx, or simple start a php server as follow:

php -S localhost:9000

Then open any example in your browser.

โš ๏ธ Some examples require you to change some parameters to work, like examples/charge/detail.php where you must change the id parameter.

Additional Documentation

The full documentation with all available endpoints is in https://dev.gerencianet.com.br/.

License

MIT

gn-api-sdk-php's People

Contributors

ceciliadeveza avatar dannielhugo avatar talitacampos avatar franciscotfmc avatar giovani-felipe avatar mariopacio avatar mpmnicolau avatar

Watchers

Vinicius Ianni 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.