sq / laravel-sevdesk-api
Laravel 的一个有用的 Sevdesk API 客户端。
Requires
- php: ^7.2|^8.0
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
README
此包可以连接到 sevdesk API 并与之交互。
安装
您可以通过 composer 安装此包。
composer require exlo89/laravel-sevdesk-api
使用以下命令设置您的 API 令牌
SEVDESK_API_TOKEN=xxxxxxxx
可选地,您可以使用以下命令发布配置文件
php artisan vendor:publish --provider="Exlo89\LaravelSevdeskApi\SevdeskApiServiceProvider" --tag="config"
这是发布配置文件的内容
return [ /* * Api token you from sevdesk. */ 'api_token' => env('SEVDESK_API_TOKEN', ''), ];
用法
首先实例化一个 sevdesk 实例。
$sevdeskApi = SevdeskApi::make();
创建联系人
创建 sevdesk 联系人。Sevdesk 中有 4 种不同的默认联系人类型。
- 供应商
- 客户
- 合作伙伴
- 潜在客户
可选的 $parameters 用于提供额外信息,如描述、增值税号或银行账号。
$sevdeskApi->contact()->createSupplier('Supplier Organisation', $parameters); $sevdeskApi->contact()->createCustomer('Customer Organisation', $parameters); $sevdeskApi->contact()->createPartner('Partner Organisation', $parameters); $sevdeskApi->contact()->createProspectCustomer('Prospect Customer Organisation', $parameters);
对于会计联系人,您必须先创建联系人。您可以使用创建的联系人 ID 创建会计联系人。
$sevdeskApi->contact()->createAccountingContact($contactId);
对于自定义联系人类型,请使用您自定义的分类 ID。
$sevdeskApi->contact()->createCustom('Custom Organisation', $categoryId, $parameters);
有关更多信息,请参阅 创建联系人。
检索联系人
获取所有联系人。
$sevdeskApi->contact()->all(); $sevdeskApi->contact()->allSupplier(); $sevdeskApi->contact()->allCustomer(); $sevdeskApi->contact()->allPartner(); $sevdeskApi->contact()->allProspectCustomer();
获取所有自定义类型的联系人。
$sevdeskApi->contact()->allCustom($categoryId);
获取单个联系人。
$sevdeskApi->contact()->get($contactId);
更新联系人
要更新单个联系人,需要 $contactId。
$sevdeskApi->contact()->update($contactId, $parameters);
删除联系人
要删除单个联系人,需要 $contactId。
$sevdeskApi->contact()->delete($contactId);
创建联系人地址
$sevdeskApi->contactAddress()->create($contactId, $parameters);
创建通讯方式
创建电话号码。
$sevdeskApi->communicationWay()->createPhone($contactId, $phoneNumber);
创建电子邮件。
$sevdeskApi->communicationWay()->createEmail($contactId, $email);
创建网站。
$sevdeskApi->communicationWay()->createWebsite($contactId, $website);
检索通讯方式
检索所有通讯方式。
$sevdeskApi->communicationWay()->all();
检索特定联系人的通讯方式。
$sevdeskApi->communicationWay()->get($contactId);
删除通讯方式
要删除单个通讯方式。
$sevdeskApi->communicationWay()->delete($communicationWayId);
检索发票
获取所有发票。
$sevdeskApi->invoice()->all();
按状态 draft、open 或 payed 过滤所有发票。
$sevdeskApi->invoice()->allDraft(); $sevdeskApi->invoice()->allOpen(); $sevdeskApi->invoice()->allPayed();
按给定 $contactId 过滤所有发票。
$sevdeskApi->invoice()->allByContact($contactId);
按给定 $timestamp 过滤所有发票。
$sevdeskApi->invoice()->allAfter($timestamp); $sevdeskApi->invoice()->allBefore($timestamp);
下载给定 $invoiceId 的 pdf 文件。
$sevdeskApi->invoice()->download($invoiceId);
将发票发送到给定 $email。使用 $subject 和 $text 编辑邮件。$text 可以包含 html。
$sevdeskApi->invoice()->sendPerMail($invoiceId, $email, $subject, $text);
更新日志
请参阅 更新日志 以获取有关最近更改的更多信息。
贡献
请参阅 贡献 以获取详细信息。
安全
如果您发现任何安全相关的问题,请通过电子邮件 hello@martin-appelmann.de 联系我们,而不是使用问题跟踪器。
鸣谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。
Laravel 包模板
此包是使用 Laravel 包模板 生成的。