jaakkom/procountor-php

There is no license information available for the latest version (dev-master) of this package.

PHP Procountor client

dev-master 2023-09-20 07:49 UTC

This package is auto-updated.

Last update: 2024-04-20 09:00:32 UTC


README

Introduction

This opensource project is about procountor API

Start

use Procountor\Interfaces\LoggerInterface;

$yourLogger = new class() implements LoggerInterface {....}
$client = new Client($yourLogger);

$client->authenticateByApiKey(
    $clientId,
    $clientSecret,
    $redirectUri,
    $apiKey,
    $company
);

API connection

This is how to connect to invoices's API endpoint:

$invoicesApi = new Invoices($client);

Search invoices

$invoices = $invoicesApi->get();

Get an invoice

To get an invoice with ID = 1212:

$invoicesApi->get(1212);

Posting a new invoice

To post a new invoice, you need first to implement your own adapter:

$newInvoice = new class($yourdata) implements \Procountor\Interfaces\Write\Invoice {
    private $data;

    public function __construct($yourdata) {
        $this->data = $yourdata;
    }

    // then create the related getters:

    public function getPartnerId() {
        return $this->data->partnerid;
    }
    // ...etc
}

Finally you can properly post the invoice:

$invoice = $invoicesApi->post($newInvoice)

Developing

Documents about developing this project can be found under /doc directory