shufflingpixels/bokio-php

PHP Wrapper for the experimental Bokio API

v0.0.1 2025-03-05 06:13 UTC

This package is auto-updated.

Last update: 2025-05-05 06:42:36 UTC


README

PHP Wrapper for the experimental Bokio API

Install

Install via composer

composer require shufflingpixels/bokio-php

Example

<?php

require_once 'vendor/autoload.php';

use Shufflingpixels\BokioApi\Api;
use Shufflingpixels\BokioApi\Auth;
use Shufflingpixels\BokioApi\Enum\CustomerType;
use Shufflingpixels\BokioApi\Enum\LanguageEnum;
use Shufflingpixels\BokioApi\Exception\ApiException;
use Shufflingpixels\BokioApi\Exception\Exception;
use Shufflingpixels\BokioApi\Objects\Customer;

$api = new Api(new Auth('<company_id>', '<token>'));

try {
    $customer = new Customer([
        'name' => "Created From Api",
        'type' => CustomerType::COMPANY,
        'vatNumber' => "SE1234567890",
        'orgNumber' => "123456-7890",
        'contactsDetails' => [
            [
                'name' => 'Person 1',
                'email' => 'test@example.com',
                'phone' => '0739281831',
                'isDefault' => true,
            ],
            [
                'name' => 'Person 2',
            ],
        ],
        "address" => [
            'line1' => 'Älvsborgsvägen 10',
            'city' => 'Göteborg',
            'postalCode' => '123 45',
            'country' => 'SE',
        ],
        'language' => LanguageEnum::SV,
    ]);

    $response = $api->customer()->create($customer);

    print_r($response);
} catch (ApiException $e) {
    print_r($e->getError());
} catch (Exception $e) {
    print_r($e);
}

Implemented

Author

Henrik Hautakoski henrik@shufflingpixels.com