Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions ExampleInstance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
use Beyonic\Beyonic;

require "vendor/autoload.php";

/**
* Instance usage
*/
$beyonic = new Beyonic('840604c20904844jjdjfhdj8747673n43j33k93');

/**
* Make a Payment i.e access the \Beyonic\Collection\Payment object
* Through this one instance
*/

$values = [
"phonenumber" => '+256702880228',
"amount" => '500',
"currency" => "UGX",
"description" => 'Units Payment',
"metadata" => ['id' => '58475848kdd', 'appId' => 'Company Details Payment'],
"send_instructions" => true
];
$beyonic->payment()->create($values);

/**
* Make a Request i.e access the \Beyonic\Collection\Request object
* Through this one instance
*/

$beyonic->request()->create($values);
/**
* Make a Response call i.e access the \Beyonic\Collection\Response object
* Through this one instance
*/
$beyonic->response()->getAll();
/**
* Make a call to Accounts i.e access the \Beyonic\Collection\Account object
* Through this one instance
*/
$beyonic->account()->get(23343);
/**
* Make a call to Contacts i.e access the \Beyonic\Collection\Contact object
* Through this one instance
*/
$beyonic->contact()->getAll();
/**
* Make a call to a Collection i.e access the \Beyonic\Collection\Collection object
* Through this one instance
*/
$beyonic->collection()->getAll();
/**
* Make a Transaction i.e access the \Beyonic\Collection\Transaction object
* Through this one instance
*/
$beyonic->transaction()->getAll();
/**
* Make a WebHook i.e access the \Beyonic\Collection\WebHook object
* Through this one instance
*/
$beyonic->webHook()->get(47737);
67 changes: 67 additions & 0 deletions ExampleStatic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
use Beyonic\Beyonic;

require "vendor/autoload.php";

/**
* Some developers find it easy for them to be able
* to access api calls with static references of
* different class if known.
*
* There is no problem if this since I just extended the functionality but still
* a single instance of new \Beyonic\Beyonic(key) or (new \Beyonic\Beyonic())->setApiKey(key)
* is needed. The rest are optional
*
* Let's see how it works
*/

$beyonic = new Beyonic('840604c20904844jjdjfhdj8747673n43j33k93');
$values = [
"phonenumber" => '+256702880228',
"amount" => '500',
"currency" => "UGX",
"description" => 'Units Payment',
"metadata" => ['id' => '58475848kdd', 'appId' => 'Company Details Payment'],
];
/**
* Make a Payment i.e access the \Beyonic\Collection\Payment object
* Through this one instance
*/
$payment = \Beyonic\Collection\Payment::create($values);

/**
* Make a Request i.e access the \Beyonic\Collection\Request object
* Through this one instance
*/

$request = \Beyonic\Collection\Request::create($values);
/**
* Make a Response call i.e access the \Beyonic\Collection\Response object
* Through this one instance
*/
$response = \Beyonic\Collection\Response::getAll();
/**
* Make a call to Accounts i.e access the \Beyonic\Collection\Account object
* Through this one instance
*/
$account = \Beyonic\Collection\Account::get(23343);
/**
* Make a call to Contacts i.e access the \Beyonic\Collection\Contact object
* Through this one instance
*/
$contact = \Beyonic\Collection\Contact::getAll();
/**
* Make a call to a Collection i.e access the \Beyonic\Collection\Collection object
* Through this one instance
*/
$collection = \Beyonic\Collection\Collection::getAll();
/**
* Make a Transaction i.e access the \Beyonic\Collection\Transaction object
* Through this one instance
*/
$transaction = \Beyonic\Collection\Transaction::getAll();
/**
* Make a WebHook i.e access the \Beyonic\Collection\WebHook object
* Through this one instance
*/
$webHook = \Beyonic\Collection\WebHook::get(47737);
143 changes: 142 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ To use the library, download the latest release and uncompress it in a location
Once that's done, you can include the library in your scripts as follows:

```php
require('./lib/Beyonic.php');
use Beyonic\Beyonic;

require "vendor/autoload.php";
```

### Composer
Expand All @@ -33,3 +35,142 @@ To install the library via [Composer](https://getcomposer.org/), add composer.js
Please visit http://support.beyonic.com/api for usage documentation

[![Latest Stable Version](https://poser.pugx.org/beyonic/beyonic-php/v/stable.svg)](https://packagist.org/packages/beyonic/beyonic-php) [![Latest Unstable Version](https://poser.pugx.org/beyonic/beyonic-php/v/unstable.svg)](https://packagist.org/packages/beyonic/beyonic-php) [![Total Downloads](https://poser.pugx.org/beyonic/beyonic-php/downloads.svg)](https://packagist.org/packages/beyonic/beyonic-php) [![License](https://poser.pugx.org/beyonic/beyonic-php/license.svg)](https://packagist.org/packages/beyonic/beyonic-php)


## **Examples for an instance object**

```php

use Beyonic\Beyonic;

require "vendor/autoload.php";

/**
* Instance usage
*/
$beyonic = new Beyonic('840604c20904844jjdjfhdj8747673n43j33k93');

/**
* Make a Payment i.e access the \Beyonic\Collection\Payment object
* Through this one instance
*/

$values = [
"phonenumber" => '+256702455228',
"amount" => '500',
"currency" => "UGX",
"description" => 'Units Payment',
"metadata" => ['id' => '58475848kdd', 'appId' => 'Company Details Payment'],
"send_instructions" => true
];
$beyonic->payment()->create($values);

/**
* Make a Request i.e access the \Beyonic\Collection\Request object
* Through this one instance
*/

$beyonic->request()->create($values);
/**
* Make a Response call i.e access the \Beyonic\Collection\Response object
* Through this one instance
*/
$beyonic->response()->getAll();
/**
* Make a call to Accounts i.e access the \Beyonic\Collection\Account object
* Through this one instance
*/
$beyonic->account()->get(23343);
/**
* Make a call to Contacts i.e access the \Beyonic\Collection\Contact object
* Through this one instance
*/
$beyonic->contact()->getAll();
/**
* Make a call to a Collection i.e access the \Beyonic\Collection\Collection object
* Through this one instance
*/
$beyonic->collection()->getAll();
/**
* Make a Transaction i.e access the \Beyonic\Collection\Transaction object
* Through this one instance
*/
$beyonic->transaction()->getAll();
/**
* Make a WebHook i.e access the \Beyonic\Collection\WebHook object
* Through this one instance
*/
$beyonic->webHook()->get(47737);

```

## **Examples for a static object**

```php

use Beyonic\Beyonic;

require "vendor/autoload.php";

/**
* Some developers find it easy for them to be able
* to access api calls with static references of
* different classes if known.
*
* There is no problem with this since I just extended the functionality but still
* a single instance of new \Beyonic\Beyonic(key) or (new \Beyonic\Beyonic())->setApiKey(key)
* is needed. The rest are optional
*
* Let's see how it works
*/

$beyonic = new Beyonic('840604c20904844jjdjfhdj8747673n43j33k93');
$values = [
"phonenumber" => '+256702455228',
"amount" => '500',
"currency" => "UGX",
"description" => 'Units Payment',
"metadata" => ['id' => '58475848kdd', 'appId' => 'Company Details Payment'],
];
/**
* Make a Payment i.e access the \Beyonic\Collection\Payment object
* Through this one instance
*/
$payment = \Beyonic\Collection\Payment::create($values);

/**
* Make a Request i.e access the \Beyonic\Collection\Request object
* Through this one instance
*/

$request = \Beyonic\Collection\Request::create($values);
/**
* Make a Response call i.e access the \Beyonic\Collection\Response object
* Through this one instance
*/
$response = \Beyonic\Collection\Response::getAll();
/**
* Make a call to Accounts i.e access the \Beyonic\Collection\Account object
* Through this one instance
*/
$account = \Beyonic\Collection\Account::get(23343);
/**
* Make a call to Contacts i.e access the \Beyonic\Collection\Contact object
* Through this one instance
*/
$contact = \Beyonic\Collection\Contact::getAll();
/**
* Make a call to a Collection i.e access the \Beyonic\Collection\Collection object
* Through this one instance
*/
$collection = \Beyonic\Collection\Collection::getAll();
/**
* Make a Transaction i.e access the \Beyonic\Collection\Transaction object
* Through this one instance
*/
$transaction = \Beyonic\Collection\Transaction::getAll();
/**
* Make a WebHook i.e access the \Beyonic\Collection\WebHook object
* Through this one instance
*/
$webHook = \Beyonic\Collection\WebHook::get(47737);
Loading