clyde / clyde-sdk
PHP SDK for Clyde insurance marketplace.
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 8
Forks: 0
Open Issues: 3
Type:sdk
Requires
- php: >=7.1
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- codeception/codeception: ^2.5
- dev-master
- dev-dependabot/composer/guzzlehttp/guzzle-6.5.8
- dev-dependabot/composer/guzzlehttp/psr7-1.8.5
- dev-dependabot/composer/codeception/codeception-3.1.3
- dev-feature/default-basic-auth-172466081
- dev-feature/api-and-docs-cleanup-170244666
- dev-feature/add-delete-product-163744617
- dev-feature/add-missing-params-to-products-call-165695072
- dev-feature/proofread-and-edit-README-165723394
- dev-feature/add-ip-product-165698628
- dev-develop
This package is auto-updated.
Last update: 2025-06-22 01:07:42 UTC
README
A PHP library for the Clyde API. Head to https://api.joinclyde.com/docs for full documentation.
Install
$ composer require "clyde-sdk"
Getting started
The framework supports all Clyde API Endpoints. For complete information about the API, head to the docs.
All endpoints require a valid clientKey
and clientSecret
.
// Instantiate a Clyde object. First paramater is the key, // second parameter the secret, and last is isLive (defaults to false). $clyde = new Clyde('ck_your_key', 'sk_your_secret', true);
When testing, Set isLive
to false
(third arguement on the class contructor), and use test keys instead of live keys. This will allow you to test without creating active customers or contracts. When you are done testing, set isLive
to true
and use your live keys. Note that at this point all contract orders are considered live and valid.
Methods
All methods will return an associative array. See full documentation for the array structures returned with each call.
Create Product
Create a product. Please see documentation for available properties.
$newProduct = $clyde.createProduct($productOptions);
Update Product
Update your product. First parameter is the product SKU; second is an associative array with the product updates. See documentation for a full list of options and return structure.
$updatedProduct = $clyde.updateProduct($sku, $productOptions);
Get One Product
Get only one product. Product SKU is the first parameter; there is an optional second parameter of an IP address for geo-sensitive queries.
$product = $clyde.getProduct($sku);
Get Many Products
Get all products associated with your store. Optionally, you may pass in an opts
associative array with a page
key and / or a sku
key as an array of SKUs to retrieve a particular page or a subset of SKUs, as well as an IP address for geo-sensitive queries.
$products = $clyde.getProducts($optionalOpts, $optionalIp);
Get Contracts for a Product
Get all available contracts for a product. Product SKU is the first parameter; there is an optional second parameter of anIP address for geo-sensitive queries.
$contracts = $clyde.getContractsForProduct($sku, $optionalIp);
Create Order
Create an order. Use this to create a contract sale or report line items of insurable products for later sales. First parameter is your internal ID for the order; second is an associative array with the parameters of your order. Please see our documentation for available options.
$order = $clyde.createOrder($id, $orderOpts);
Get Order
Get an order that has already been placed. The order ID from your system is the first and only parameter.
$order = $clyde.getOrder($id);
Cancel Order
Cancel an order you have already placed. Use this to cancel all contract sales, or generally remove from our system all line items associated with an order. The order ID from your system is the first and only parameter.
$order = $clyde.cancelOrder($id);
Get Contract Sale
Get a previously sold contract sale. The ID returned from the original sale is the first and only parameter.
$contractSale = $clyde.getContractSale($clydeId);
Cancel Contract Sale
Cancel a previously sold contract sale. The ID returned from the original sale is the first and only parameter.
$contractSale = $clyde.cancelContractSale($clydeId);
Error Handling
When an error occurs clyde-sdk
will throw that error. Use try / catch
to handle errors.
try { $newProduct = $clyde.createProduct($productOptions); } catch(Exception $e) { // Handle the exception }
License
MIT