webard/nova-zadarma
Composer 安装命令:
composer require webard/nova-zadarma
包简介
Zadarma VoIP integration to Laravel Nova. Make and receive phone calls directly from your Nova interface.
README 文档
README
Description
This package provides integration between Laravel Nova and the Zadarma VoIP service. It allows you to make, receive and manage phone calls directly from your Nova interface!
Installation
Step 1: Install the package
Run the following command to install the package:
composer require webard/nova-zadarma
Step 2: Publish the configuration
Publish the package configuration using the following command:
php artisan vendor:publish --provider="Webard\NovaZadarma\NovaZadarmaServiceProvider" --tag=config
Step 3: Provide API keys from Zadarma
Add this lines to .env file and fill them:
ZADARMA_KEY= ZADARMA_SECRET= ZADARMA_SIP_LOGIN=
Zadarma Secret and Key you can find in Settings -> Integrations and API -> Keys and API:
Zadarma SIP Login is the suffix of PBX number, which can be found under My PBX -> Extensions.
Your SIP Login is behind the painted field.
Step 4: Publish the migrations
Publish the package migrations using the following command:
php artisan vendor:publish --provider="Webard\NovaZadarma\NovaZadarmaServiceProvider" --tag=migrations
Step 5: Register tool in NovaServiceProvider
use Webard\NovaZadarma\NovaZadarmaTool; public function tools() { return [ ... NovaZadarmaTool::make(), ]; }
Step 6: Update the User model
- Add the
HasPhoneCallstrait to the User model - Add
zadarma_sipandphone_numberto$fillableproperty - Cast
phone_numberfield toE164PhoneNumberCast::class.
use Propaganistas\LaravelPhone\Casts\E164PhoneNumberCast; use Webard\NovaZadarma\Traits\HasPhoneCalls; class User extends Authenticatable { use HasPhoneCalls; protected $fillable = [ ... 'zadarma_sip', 'phone_number' ]; protected function casts(): array { return [ ... 'phone_number' => E164PhoneNumberCast::class, ]; } }
Step 7: Modify User resource
- Add
Zadarma SIPfield - Add
Phone Numberfield - Add
UserPhoneCallsfield
use Webard\NovaZadarma\Nova\Fields\UserPhoneCalls; class User extends Resource { public function fields(NovaRequest $request) { return [ ... Text::make(__('Zadarma SIP'), 'zadarma_sip') ->sortable() ->nullable() ->rules('nullable', 'max:4'), Text::make(__('Phone Number'), 'phone_number') ->sortable() ->rules('nullable', 'max:20', 'phone'), UserPhoneCalls::make(), ]; } }
Step 8: Add the phone call action to the User resource
Add the MakePhoneCall action to the User resource:
use Webard\NovaZadarma\Nova\Actions\MakePhoneCall; class User extends Resource { public function actions(NovaRequest $request) { return [ ... MakePhoneCall::make() ->sole() ]; } }
Warning
MakePhoneCall action must be sole, because User can make call to only one user at time.
Tip
You can add ->withoutConfirmation() method to action to allow making phone calls directly after clicking action.
Step 9: Fill SIP Number in your User profile of Nova
Go to your User edit form and fill Zadarma SIP according to SIP number in Zadarma panel. Default created SIP number is 100:
Webhooks
Step 1: Enable "Notifications" in integrations
Go to Settings -> Integrations and API -> Integrations in Zadarma Panel and enable "Notifications" integration.
Step 2: Fill settings of "Notifications" integration
Go to Notifications settings and enter webhook URL:
https://YOUR-DOMAIN.com/nova-vendor/webard/nova-zadarma/webhook
and enable checkboxes:
- NOTIFY_START
- NOTIFY_END
- NOTIFY_OUT_START
- NOTIFY_OUT_END
- NOTIFY_RECORD
Step 3: Add webhook URL to ignore
Go to bootstrap/app.php file and modify withMiddleware method:
return Application::configure(basePath: dirname(__DIR__)) ->withMiddleware(function (Middleware $middleware) { $middleware->validateCsrfTokens(except: [ '/nova-vendor/webard/nova-zadarma/webhook', ]); }) ->withExceptions(function (Exceptions $exceptions) { // }) ->create();
If you have fruitcake/laravel-telescope-toolbar installed, add webhook URL to ignore_paths in config/telescope-toolbar.php
'ignore-paths' => [ 'nova-vendor/webard/nova-zadarma/webhook' ]
TODO
I'm are actively seeking contributions to enhance this package. Here are some features I would love to see implemented:
- documentation for Gate
- documentation for Events
- ability to go offline (disable widget on demand)
- more options for icon in header
- after call action modal with customized fields (feedback modal)
- phone call transcriptions using OpenAI/Google Speech To Text/Assembly.ai
Contributing
We welcome contributions to improve this plugin! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with descriptive messages.
- Push your changes to your forked repository.
- Open a pull request to the main repository.
License
This project is licensed under the MIT License. See the LICENSE.md file for more details.
Contact
For questions or support, please open an issue on GitHub.
webard/nova-zadarma 适用场景与选型建议
webard/nova-zadarma 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.02k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「phone」 「nova」 「laravel」 「voip」 「zadarma」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 webard/nova-zadarma 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webard/nova-zadarma 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 webard/nova-zadarma 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
Phone helper & validator for Nette Framework
A Laravel Nova card.
Yii2 phone formatter and validator.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
统计信息
- 总下载量: 4.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-03






