aryxs3m / alegza-crm-api
用于使用 Alegza REST API 的 Composer 包。
dev-master
2021-07-18 14:07 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^7.0
This package is not auto-updated.
Last update: 2024-09-24 04:54:59 UTC
README
此包帮助从 PHP 使用 Alegza CRM API。至少需要 PHP 7.0。
许可证: MIT
Alegza CRM 网站: https://alegza.hu
与包开发者联系: aryxs3m (Tóth Patrik)
安装
可以通过以下命令使用 composer 安装此包:
composer require aryxs3m/alegza-crm-api
命令。
示例
在 examples/ 文件夹中有一个示例,展示了大多数功能的工作方式。
使用
示例代码
创建一个示例的示例
$alegza = new AlegzaAPI( 'https://test.alegza.hu', 'apitest@alegza.hu', 'api12345678' ); try { $newPerson = $alegza->newPerson(new Person([ 'full_name' => 'Teszt Személy', 'age' => 24, 'city' => 'Kecel', 'phone' => '+36803344556', 'relationship_state' => 1 ])); } catch (APIException $exception) { echo "API hiba: {$exception->getMessage()}"; }
模型
该包将 API 响应转换为模型,并通过创建此类模型可以发送数据以及修改现有资源。模型的属性与 Alegza API 文档中找到的属性一致。
例如,从获取条目中生成的 Post
类型的类
AlegzaCRM\AlegzaAPI\Models\Post Object
(
[id] => 53
[created_at] => 2021-07-18T13:54:19.000000Z
[updated_at] => 2021-07-18T13:54:19.000000Z
[person] => 10606
[type] => 3
[post_timestamp] => 2021-07-18T11:54:19.000000Z
[message] => Visszahívást kért ma délutánra.
[success] =>
[deleted_at] =>
[user_id] =>
)