Analog Bridge
Analog Bridge is comprised of a JavaScript client and REST API which enables
your users to import analog media directly into your app or website., (*1)
Full documentation at the Analog Bridge docs, (*2)
Installation
Install with composer:, (*3)
composer require analogbridge/analog-bridge-php
Or download the source:, (*4)
$ git clone https://github.com/analogbridge/analog-bridge-php.git
Once you have your API Keys from Analog Bridge, you can initialize your configuration with your secret_key
as, (*5)
$bridge = new \AnalogBridge\Customer("Your secret API Key");
Usage
Customer
Create Customer
To create a new customer using the API, usage, (*6)
$bridge = new \AnalogBridge\Customer("Your secret API Key");
$customer = $bridge->create([
"email" => "demo@analogbridge.io",
"shipping" => [
"first_name" => "John",
"last_name" => "Smith",
"address1" => "3336 Commercial Ave",
"city" => "Northbrook",
"state" => "IL",
"zip" => "60062",
"phone" => "800-557-3508",
"email" => "demo@analogbridge.io"
],
"metadata" => [
"user_id" => 123456
]
]);
Retrieve a Customer
We can easily retrieve a customer's details using their customer_id
, for
example to find a customer with details with id cus_12345678
, (*7)
$customer = $bridge->get("cus_12345678");
Retrieve all customers
Analog Bridge provides an interface to retrieve all your customers very easily.
To retrieve all of your customers, you can use, (*8)
$customers = $bridge->all(["offset" => 100, "limit" => 100]);
Update a customer
Update an existing customer's information by using the cus_id
from customer
creation. Any unprovided parameters will have no effect on the customer object.
The arguments for this call are mainly the same as for the customer creation
call., (*9)
$bridge->update("cus_12345678", [
"email" => "new-email@analogbridge.io",
"shipping" => [
"address1" => "123 Main St.",
"city" => "New York",
"state" => "NY",
"zip" => "12345"
]
]);
Delete a customer
If we need to delete a customer, for example id cus_123456789
, then we can
use, (*10)
$bridge->delete("cus_123456789");
Order
List all customer orders
The Analog Bridge API allow us to retrieve all orders by a specific customer
.
For example we want to retrieve all orders
by customer id cus_12345678
,
we can use, (*11)
$bridge = new \AnalogBridge\Order("Your secret API Key");
$order = $bridge->all("cus_3ab7aa6ec5feda6fe8a3");
List order details
If we need to retrieve the details for a specific order then we can use, (*12)
$order = $bridge->get("cus_3ab7aa6ec5feda6fe8a3", "ord_fe310b878dc3313c3c2e");
Retrieve import ready orders
Once customer orders have been processed and uploaded to our Cloud, they are import-ready for your system.
To retrieve the list of import ready orders, we can use, (*13)
$order = $bridge->import_ready();
Listing Product
To retrieve the products
simply use the following interface, (*14)
$bridge = new \AnalogBridge\Product();
$products = $bridge->all();
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/analogbridge/analog-bridge-php. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct., (*15)
License
This package is available as open source under the terms of the MIT License., (*16)