1. Go to this page and download the library: Download lsolesen/billy-php-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lsolesen / billy-php-sdk example snippets
5
use Billy\Client\Client as Billy_Client;
use Billy\Client\Request as Billy_Request;
try {
$request = new Billy_Request($api_key);
$client = new Billy_Client($request);
} catch (Exception $e) {
//...
}
5
use Billy\Contacts\ContactRepository;
try {
// @todo: This will probably end up becoming an object of its own.
$persons = array(
array(
'name' => $name,
'email' => $email,
)
);
$contact = new Contact();
$contact
->setName($name)
->set('phone', $phone)
->setCountryID($address['country'])
->set('street', $address['thoroughfare'])
->set('cityText', $address['locality'])
->set('stateText', $address['administrative_area'])
->set('zipcodeText', $address['postal_code'])
->set('contactNo', $profile_id)
->set('contactPersons', $persons);
$repository = new ContactRepository($request);
$created_contact = $repository->create($contact);
$contact = $repository->getSingle($created_contact->getID());
$contact
->setName($new_name);
$repository->update($contact);
} catch (Exception $e) {
//...
}