enlivy/enlivy-php
Composer 安装命令:
composer require enlivy/enlivy-php
包简介
Official PHP client library for the Enlivy API
README 文档
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
$client = new \Enlivy\EnlivyClient([ 'api_key' => '1|your_api_token', 'organization_id' => 'org_xxx', ]); // List invoices $invoices = $client->invoices->list(['per_page' => 25]); foreach ($invoices as $invoice) { echo $invoice->id . "\n"; } // Create $invoice = $client->invoices->create([ 'organization_receiver_user_id' => 'org_user_xxx', 'status' => 'draft', 'currency' => 'EUR', 'payment_method' => 'bank_transfer', 'delivery_method' => 'email', 'line_items' => [ [ 'name_lang_map' => ['en' => 'Consulting Services'], 'quantity' => 10, 'price' => 100.00, 'type' => 'service', ], ], ]); // Retrieve with related data $invoice = $client->invoices->retrieve('org_inv_xxx', [ 'include' => ['sender_user', 'receiver_user', 'line_items'], ]); // Update $client->invoices->update('org_inv_xxx', ['status' => 'pending']); // Delete $client->invoices->delete('org_inv_xxx');
Configuration
// Per-client configuration $client = new \Enlivy\EnlivyClient([ 'api_key' => '1|your_token', 'organization_id' => 'org_xxx', 'api_base' => 'https://api.enlivy.com', 'timeout' => 30, ]); // Or global configuration \Enlivy\Enlivy::setApiKey('1|your_token'); \Enlivy\Enlivy::setOrganizationId('org_xxx'); $client = new \Enlivy\EnlivyClient();
Documentation
Detailed guides with code examples for every feature:
Getting Started
| Guide | Description |
|---|---|
| Authentication | API keys, OAuth client credentials, global config |
| OAuth Server | OAuth 2.0 server for third-party app integrations |
| Includes (Eager Loading) | Load related resources in a single request |
| Filters | Search, sort, paginate, and filter list endpoints |
Billing & Invoicing
| Guide | Description |
|---|---|
| Invoices | Create, send, and manage invoices |
| Receipts | Receipt management and tracking |
| Billing Packages | Reusable billing templates with payment plans |
| Proposals | Send proposals to prospects and customers |
| Products | Product and service catalog |
| Taxes | Tax classes, rates, and filing jurisdictions |
CRM & Sales
| Guide | Description |
|---|---|
| Prospects | Sales pipeline, lead tracking, and CRM |
| Organization Users | Customers, employees, and roles |
| Projects | Projects, team members, and permissions |
Contracts
| Guide | Description |
|---|---|
| Contracts | Contract management, e-signatures, and templates |
Banking
| Guide | Description |
|---|---|
| Bank Accounts | Bank accounts, transactions, and reconciliation |
Content & Reports
| Guide | Description |
|---|---|
| Reports | Dynamic reports with custom schemas |
| Files | File uploads and attachments |
Integrations
| Guide | Description |
|---|---|
| Event Destinations | Real-time event delivery (webhooks, Slack) and signature verification |
| Event Trails | Read-only audit history for invoices, receipts, and billing schedules |
| Customer Portal | Client-facing portal for invoices, contracts, and proposals |
| Integrations | Stripe, ANAF, and other third-party services |
| AI Agents | AI-powered automation |
Error Handling
use Enlivy\Exception\{ ValidationException, NotFoundException, AuthenticationException, RateLimitException, }; try { $invoice = $client->invoices->retrieve('org_inv_xxx'); } catch (ValidationException $e) { $errors = $e->errors(); // ['field' => ['error message']] } catch (NotFoundException $e) { // 404 } catch (AuthenticationException $e) { // 401 } catch (RateLimitException $e) { $retryAfter = $e->retryAfter(); // seconds }
Pagination
$invoices = $client->invoices->list(['page' => 1, 'per_page' => 25]); echo "Page " . $invoices->getCurrentPage() . " of " . $invoices->getTotalPages(); foreach ($invoices as $invoice) { echo $invoice->id; }
API Discovery
The SDK includes a discovery service for programmatic API introspection:
// List all available API resources $resources = $client->discovery->list(); // Get detailed metadata for a specific resource $invoiceSpec = $client->discovery->resource('organization_invoices');
Key Concepts
Multilingual Fields
Most text fields use _lang_map for multilingual support:
'name_lang_map' => [ 'en' => 'Consulting Services', 'ro' => 'Servicii de Consultanta', ],
ID Prefixes
All IDs use prefixes to identify the resource type:
| Prefix | Resource |
|---|---|
org_ |
Organization |
org_user_ |
Organization User |
org_inv_ |
Invoice |
org_cont_ |
Contract |
org_pros_ |
Prospect |
org_proj_ |
Project |
org_prod_ |
Product |
org_prop_ |
Proposal |
Testing
./vendor/bin/phpunit # Unit tests ./vendor/bin/phpstan analyse # Static analysis
License
MIT License. See LICENSE for details.
Support
enlivy/enlivy-php 适用场景与选型建议
enlivy/enlivy-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 167 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sdk」 「crm」 「business」 「invoicing」 「contracts」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 enlivy/enlivy-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 enlivy/enlivy-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 enlivy/enlivy-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP client for the Salesforce SOAP API
A PSR-7 compatible library for making CRUD API endpoints
Command-line utility for Vtiger CRM.
Library for Kommo (AmoCRM)
Laravel Package for capsule CRM integration
File explorer for Appui
统计信息
- 总下载量: 167
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-05