crisphive/crisphive-php

Official PHP SDK for the CrispHive API.

Maintainers

Package info

github.com/crisphive/crisphive-php

Homepage

pkg:composer/crisphive/crisphive-php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-07-01 04:00 UTC

This package is auto-updated.

Last update: 2026-07-02 01:51:19 UTC


README

The official PHP SDK for the CrispHive API.

Typed access to the public /v1 API — customers, bookings, catalog, team and fleet.

Requirements

PHP 7.4+ with the curl, json and mbstring extensions.

Installation

composer require crisphive/crisphive-php

Authentication

Every request is authenticated with a secret API key sent as a bearer token. Create keys from your CrispHive business dashboard. The key prefix selects the data environment:

  • chsk_live_… → live (production) data
  • chsk_test_… → sandbox (isolated test) data

Load keys from the environment — never commit them.

Usage

<?php
require_once __DIR__ . '/vendor/autoload.php';

$config = Crisphive\Configuration::getDefaultConfiguration()
    ->setAccessToken(getenv('CRISPHIVE_API_KEY')); // SDK adds the "Bearer " prefix

$customers = new Crisphive\Api\CustomerApi(new GuzzleHttp\Client(), $config);

// List customers.
$res = $customers->listCustomers(null, null, null, null, null, 1, 20);
foreach ($res->getData()->getCustomers() ?? [] as $c) {
    echo $c->getId() . ' ' . $c->getFullName() . "\n";
}

// Create a customer.
try {
    $body = new Crisphive\Model\CustomerCreateRequest([
        'full_name' => 'Ada Lovelace',
        'email'     => 'ada@example.com',
    ]);
    $created = $customers->createCustomer($body);
    echo 'created ' . $created->getData()->getCustomerId() . "\n";
} catch (Crisphive\ApiException $e) {
    echo 'error ' . $e->getCode() . ' ' . $e->getResponseBody() . "\n";
}

Method parameter lists follow the generated signatures — see the API reference for the exact arguments of each call.

Pagination

List methods accept $page / $limit and return a meta object (total, count, per_page, current_page, total_pages).

Idempotency

create* calls (customers, bookings) accept an Idempotency-Key so retries never create a duplicate.

Errors

Non-2xx responses throw Crisphive\ApiException; inspect $e->getCode() and $e->getResponseBody() for the CrispHive error code.

Documentation

License

MIT