brightpearl-php

Brightpearl PHP API Wrapper

MIT License

Downloads
37
Stars
3
Committers
2

Brightpearl PHP API WRAPPER

This package uses arrays for the same json requests as you would send to the Brightpearl API. Please refer to the Brightpearl API docs for extra/optional field info.

Installation

Begin by pulling in the package through Composer.

composer require developifynet/brightpearl-php

Usage

Please note that all requests in

Basic (any php app)

use \Developifynet\Brightpearl\BrightpearlClient;

$client = new BrightpearlClient([
                'app_reference' => 'your-api-reference',
                'account_code'  => 'your-account',
                'account_token' => 'your-app-token',
                'api_domain'    => 'ws-eu1.brightpearl.com', // [optional], Provide URL or remove this line
            ]);
            
// or

$client = new BrightpearlClient();
$client->settings([
    'app_reference' => 'your-api-reference',
    'account_code'  => 'your-account',
    'account_token' => 'your-app-token',
    'api_domain'    => 'ws-eu1.brightpearl.com', // [optional], Provide URL or remove this line
]);

            
/**
 * Example Call
 * For more api calls check 'resources' folder
 */
$response = $client->getOrderStockStatus();

Laravel

$client = Brightpearl::settings([
                'app_reference' => 'your-api-reference',
                'account_code'  => 'your-account',
                'account_token' => 'your-app-token',
                'api_domain'    => 'ws-eu1.brightpearl.com', // [optional], Provide URL or remove this line
            ]);
/**
 * Example Calls
 * For more api calls check 'resources' folder
 */
$response = Brightpearl::getOrderStockStatus();             // Optional $ids,  e.g. '1' or '1-3,4,5'
$response = Brightpearl::getOrder();                        // Optional $ids,  e.g. '1' or '1-3,4,5'

Services

These are the api method calls generated by the service config files using GuzzleHttp/Guzzle-Services. For

Contact

getContact() - Retrieve contact info

// All Contacts
$contact = $client->getContact();

// Contact by idset
$contact = $client->getContact(['id' => '1-3,4,5']);

// get a specific contact by id
$contact = $client->getContact(['id' => '1']);

Order

getOrder() - Retrieve order(s)

// All Orders
$order = $client->getOrder();

// Order by id
$order = $client->getOrder('1');

// Orders by idset
$orders = $client->getOrder('1-3,4,5');

Other Available Services

// Order Types
$order_types = $client->getOrderType();             // Optional $ids,  e.g. '1' or '1-3,4,5'
// Product Prices
$product_prices = $client->getProductPrice();       // Optional $ids,  e.g. '1' or '1-3,4,5'
// Price Lists
$price_lists = $client->getPriceList();             // Optional $ids,  e.g. '1' or '1-3,4,5'
// All Price Lists Urls
$price_list_urls = $client->optionsProductPrice();  // Optional $ids,  e.g. '1' or '1-3,4,5'
// All Contacts Urls
$contact_urls = $client->optionsContact();          // Optional $ids,  e.g. '1' or '1-3,4,5'
// All Orders Urls
$order_urls = $client->optionsOrder();              // Optional $ids,  e.g. '1' or '1-3,4,5'
// All Orders Urls
$order_urls = $client->optionsOrder();              // Optional $ids,  e.g. '1' or '1-3,4,5'
// Order Statuses
$order_statuses = $client->getOrderStatus();
// Warehouses
$warehouses = $client->getWarehouse();
// Channels
$channels = $client->getChannel();
// Order Stock Statuses
$order_stock_statuses = $client->getOrderStockStatus();
// Order Shipping Statuses
$order_shipping_statuses = $client->getOrderShippingStatus();
// Order Types
$order_types = $client->getOrderType();

Contributing

Currently API coverage only represents fetching data portion of the Brightpearl API. If you want to contribute send bug fixes, additional resource/services and features in a pull request at the develop branch. Thanks!