enlivy/enlivy-php

Official PHP client library for the Enlivy API

Maintainers

Package info

github.com/enlivy/enlivy-php

Homepage

pkg:composer/enlivy/enlivy-php

Statistics

Installs: 89

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.5 2026-03-11 19:46 UTC

This package is auto-updated.

Last update: 2026-03-13 21:35:29 UTC


README

Official PHP client library for the Enlivy API.

Requirements

  • PHP 8.3+
  • ext-curl, ext-json, ext-mbstring

Installation

composer require enlivy/enlivy-php

Quick Start

$enlivy = new \Enlivy\EnlivyClient([
    'api_key' => '1|your_api_token',
    'organization_id' => 'org_xxx',
]);

// List prospects
$prospects = $enlivy->prospects->list();

foreach ($prospects as $prospect) {
    echo $prospect->title . "\n";
}

// Create
$prospect = $enlivy->prospects->create([
    'title' => 'New Lead',
    'email' => 'lead@example.com',
]);

// Retrieve
$prospect = $enlivy->prospects->retrieve('org_pros_xxx');

// Update
$enlivy->prospects->update('org_pros_xxx', ['title' => 'Updated']);

// Delete
$enlivy->prospects->delete('org_pros_xxx');

Configuration

$enlivy = new \Enlivy\EnlivyClient([
    'api_key' => '1|your_token',       // Required (or use OAuth)
    'organization_id' => 'org_xxx',    // Default org for requests
    'api_base' => 'https://api.enlivy.com', // Optional
    'timeout' => 30,                   // Optional (seconds)
]);

For OAuth authentication, see examples/oauth.md.

Error Handling

use Enlivy\Exception\{
    ValidationException,
    NotFoundException,
    AuthenticationException,
    RateLimitException,
};

try {
    $prospect = $enlivy->prospects->retrieve('invalid_id');
} catch (ValidationException $e) {
    $errors = $e->errors(); // ['field' => ['error message']]
} catch (NotFoundException $e) {
    // 404 - Resource not found
} catch (AuthenticationException $e) {
    // 401 - Invalid credentials
} catch (RateLimitException $e) {
    $retryAfter = $e->retryAfter(); // seconds
}

Pagination

$prospects = $enlivy->prospects->list(['page' => 1, 'per_page' => 25]);

echo "Page " . $prospects->getCurrentPage() . " of " . $prospects->getTotalPages();

foreach ($prospects as $prospect) {
    echo $prospect->title;
}

Examples

See the examples/ folder for detailed usage:

Testing

./vendor/bin/phpunit              # Unit tests
./vendor/bin/phpstan analyse      # Static analysis

See TESTING.md for integration tests.

License

MIT License. See LICENSE for details.