roseblade/quickfile-php-sdk

PHP SDK for QuickFile Accounting Software JSON API

2.3.2beta 2024-04-30 09:47 UTC

README

GitHub Packagist Version GitHub issues

Wrapper for the QuickFile API.

No validation is provided by this library.

Requirements

  • PHP 8.0 and later
  • Guzzle HTTP 7.4 and later
  • ext-json

Composer

You can install the library by using Composer, and using the following command:

composer require roseblade/quickfile-php-sdk

Then use the Composer autoload library to get started:

require_once('vendor/autoload.php');

Manual

If you don't wish to use Composer, or are unable to, you can download the latest release and include the init.php file:

require_once('/path/to/roseblade/quickfile-php-sdk/init.php');

Don't forget to download and install Guzzle.

Getting Started

QuickFile Standard API

We've included an example PHP file for you to get started in /example/index.php.

To get started, you will need to set the API credentials, available within your QuickFile account.

$creds  = [
    'AccountNumber' => 6131400000,
    'APIKey'        => '000AA000-AAAA-0000-A',
    'ApplicationID' => '00000000-AAAA-AAAA-AAAA-00AA00AA00AA'
];
\QuickFile\QuickFile::config($creds);

or individually

\QuickFile\QuickFile::setAccountNumber($creds['AccountNumber']);
\QuickFile\QuickFile::setAPIKey($creds['APIKey']);
\QuickFile\QuickFile::setApplicationID($creds['ApplicationID']);

Each function can be accessed through it's own class, for example, for a client\search, you would use:

\QuickFile\Client::search([
    // Search Data
]);

And for invoice\create

\QuickFile\Invoice::create([
    // Invoice Data
]);

These all match up with the API endpoints found in the QuickFile API documentation, replacing the underscore with the function name.

For example:

  • Client_Search > \QuickFile\Client::search();
  • Project_TagCreate > \QuickFile\Project::tagCreate();
  • Supplier_Create > \QuickFile\Supplier::create();

All header information is populated for you. You need to supply everything as part of the body as per the documentation on the QuickFile site.

QuickFile Partner API

The QuickFile Partner API allows developers to make their tools available to third parties through the QuickFile Marketplace. This involves generating an app on their account so you have the correct API endpoint access.

The set up is similar to that of the individual API above:

$creds  = [
    'AccountNumber' => 6131400000,
    'Token'         => 'ABCD1234',
    'ProductKey'    => '00000000-AAAA-AAAA-AAAA-00AA00AA00AA',
    'SecretKey'     => '00000000-AAAA-AAAA-AAAA-00AA00AA00AA'
];
\QuickFile\Partner::config($creds);

or individually

\QuickFile\Partner::setAccountNumber($creds['AccountNumber']);
\QuickFile\Partner::setToken($creds['Token']);
\QuickFile\Partner::setProductKey($creds['ProductKey']);
\QuickFile\Partner::setSecretKey($creds['SecretKey']);

There are several static functions within the Partner class that can help you streamline the process:

  • authenticate(): Returns an array of API Key and ApplicationID.
  • setupConfig(): Automatically sets up the QuickFile library with these variables

For example, after configuring the class as above:

\QuickFile\Partner::authenticate();

// Or, specify the returnArray and verifyProduct
// Example below is the default - verify the product and return a bool (rather than array)

\QuickFile\Partner::authenticate(true, false);

// Or be fancy with names variables

\QuickFile\Partner::authenticate(returnArray: true, verifyProduct: false);

This can be combined with the individual API, quickly setting the config by called setupConfig() and then using the API as normal:

\QuickFile\Partner::setupConfig();
\QuickFile\Invoice::get([
    'InvoiceID' => 123456
]);

FAQ

What version of the API does this use?

It uses 1.2 of the JSON API

What methods/endpoints are supported?

Bank

Function API Docs
search Link
createAccount Link
createTransaction Link
getAccounts Link
getAccountBalances Link

Client

Function API Docs
create Link
delete Link
get Link
insertContacts Link
login Link
newDirectDebitCollection Link
search Link
update Link

Document

Function API Docs
upload Link

Estimate

Function API Docs
acceptDecline Link
convertToInvoice Link

Invoice

Function API Docs
create Link
delete Link
get Link
getPdf Link
search Link
send Link

Item (Inventory Item)

Function API Docs
create Link
delete Link
get Link
search Link

Journal

Function API Docs
create Link
delete Link
get Link
search Link

Ledger

Function API Docs
search Link
getNominalLedgers Link

Payment

Function API Docs
create Link
delete Link
get Link
getPayMethods Link
search Link

Project

Function API Docs
tagCreate Link
tagDelete Link
tagSearch Link

Purchase

Function API Docs
create Link
delete Link
get Link
search Link

PurchaseOrder

Function API Docs
create Link

Report

Function API Docs
ageing Link
balanceSheet Link
chartOfAccounts Link
profitAndLoss Link
vatObligations Link
subscriptions Link

Supplier

Function API Docs
create Link
delete Link
get Link
search Link

System

Function API Docs
createNote Link
searchEvents Link
getAccountDetails Link

Is this library supported by QuickFile?

No, this is an unofficial library

How is the data sent to QuickFile?

The data is always sent using HTTPS, using the Guzzle HTTP library. Guzzle will use cURL, but it's not required. Please see the Guzzle Website for information.

I've found a bug, where do I report it?

If it's a security bug relating to the API, you can post it to the QuickFile forum. If it's a bug with the library, please open an issue. If it's a security issue, please contact us through our website before posting it publicly.

What is API Partners?

QuickFile operates a scheme called API Partners:

As an API Partner we provide you with a framework you can use so you can tell other users about your API product

Check out their user guide for more info.

How does the API partners work?

It works by you having access to a secret key which can be combined with a user's account number and token (from the QuickFile marketplace). This generates an App ID and provides you with their API key so you can then interact with their account on their behalf.