Skip to content

melba-ch/bexio-api-php-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bexio API PHP Client

The bexio API Client Library enables you to work with the bexio API. This is an early version and is still in development.

See the bexio API documentation for more information how to use the API.

Installation

You can use Composer or download the library.

Require this package with composer:

composer require christianruhstaller/bexio-api-php-client

Include the autoloader:

require_once '/path/to/your-project/vendor/autoload.php';

Examples

Init client

    require_once '../vendor/autoload.php';
    
    $client = new \Bexio\Client([
        'clientId' => 'CLIENT_ID',
        'clientSecret' => 'CLIENT_SECRET',
    ]);
    
    $credentialsPath = 'PATH_TO_CREDENTIAL_FILE';
    
    if (!file_exists($credentialsPath)) {
        throw new \Exception('Credentials file not found for OAuth: '.$credentialsPath);
    }

    $accessToken = file_get_contents($credentialsPath);
    $client->setAccessToken($accessToken);

    if ($client->isAccessTokenExpired()) {
        $client->refreshToken($client->getRefreshToken());
        file_put_contents($credentialsPath, $client->getAccessToken());
    }

Get contacts

    $bexio = new Bexio($client);
    
    $contacts = $bexio->getContacts();

About

bexio API Library for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%