omneo / omneo-php
Omneo API 的 PHP 库
0.3.14
2023-11-14 02:35 UTC
Requires
- guzzlehttp/guzzle: ^6.3
- illuminate/support: ^5.6
- justinrainbow/json-schema: ^5.2
- nesbot/carbon: ^1.25
- symfony/psr-http-message-bridge: ^1.0
- zendframework/zend-diactoros: ^1.7
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/phpunit: ^7.1
- dev-master
- 0.3.14
- 0.3.13
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.0
- dev-add-connection-modules
- dev-develop
- dev-feature/profile-identities-raw
- dev-feature/add_create_or_update_endpoint
- dev-feature/profile_identities_by_id
- dev-feature/custom_att_v2
- dev-feature/update_profile_attribute
- dev-feature/update_profile_custom_attribute
- dev-feature/add_rating
- dev-feature/identities_batch
- dev-feature/transactions
- dev-feature/id-search
This package is not auto-updated.
Last update: 2024-10-01 07:29:54 UTC
README
Omneo PHP 是 Omneo API 服务的 PHP 客户端库。它允许开发者轻松地将 Omneo 集成到他们的 PHP 应用程序中。
先决条件
在使用此包之前,您需要以下内容。
-
Omneo 域名 - 它的形式为
example.omneoapp.io
,是您的 Omneo 安装所在之处。如果您在foo.dashboard.omneo.io
的仪表板上登录,则您的 Omneo 域名是foo.omneoapp.io
。 -
Omneo 令牌 - 这是一个安全的令牌,用于在 API 中识别您。它可以从 Omneo 仪表板生成,并与您的用户账户相关联。建议您为您的集成创建一个专门的 Omneo 用户。
-
共享密钥 - 如果您计划接受来自 Omneo 的传入 webhook 和目标请求,则需要此密钥。如果是这样,您需要通过使用共享密钥生成并比较签名来验证实际上确实是 Omneo 发送的请求。
安装
安装通过 Composer 完成。
composer require omneo/omneo-php
快速入门
纯 PHP
// Get credentials, you should store these outside of your codebase $domain = 'foo.omneoapp.io'; $token = '...'; // Instantiate the Omneo client $omneo = new Omneo\Client($domain, $token); // Optional, add the shared secret for verifying webhooks and targets $omneo->setSecret('horsebatterystaple'); // Use the client to communicate with omneo $profiles = $omneo->profiles()->browse();
Laravel
此包利用 Laravel 包发现,这意味着安装后您不需要注册任何服务提供程序,只需类型提示即可。
此包已内置用于与 Laravel 一起使用。要开始,请使用 Composer 安装包,并更新以下文件。
config/services.php
'omneo' => [ 'domain' => env('OMNEO_DOMAIN'), 'token' => env('OMNEO_TOKEN'), 'secret' => env('OMNEO_SECRET') ]
.env
OMNEO_DOMAIN= OMNEO_TOKEN= OMNEO_SECRET=
现在您的身份验证详细信息已设置,您可以在应用程序的任何位置使用 Omneo 包,只要它有权访问 服务容器。
class FooController extends Controller { public function getProfiles(Omneo\Client $omneo) { // Using typehints $profiles = $omneo->profiles()->browse(); // Using the app() method $profiles = app(Omneo\Client::class)->profiles()->browse(); } }
贡献
要为此包做出贡献,请打开 Pull Request。
测试
测试由 phpunit 处理。Pull 请求应包含受影响逻辑的单元测试。
phpunit