capeandbay/birdeye
Composer 安装命令:
composer require capeandbay/birdeye
包简介
Client-side SDK Package for Laravel that integrates with the BirdEye REST API
README 文档
README
BirdEye Service SDK for Laravel
BirdEye helps your business be found and chosen by new customers, be connected with your existing customers, and deliver the best end-to-end customer experience.
This is an implementation of the BirdEye REST API designed to be used with Laravel PHP Framework v6, 7 and beyond.
Cape & Bay is not affiliated with BirdEye. We prefer to build custom packages for our needs, but it may also help you or be a good reference for your own implementation.
Getting Started
Quick Links
Installation
Via Composer
$ composer require capeandbay/birdeye
The package will automatically register itself. You can optionally publish the config file with:
php artisan vendor:publish --provider="CapeAndBay\BirdEye\CBBirdEyeServiceProvider" --tag="config"
The settings can be found in the generated config/birdeye.php configuration file. .
You can publish the migration with:
php artisan vendor:publish --provider="CapeAndBay\BirdEye\CBBirdEyeServiceProvider" --tag="migrations"
If you need to, update the config, before running the migration.
After publishing the migration you can create the birdeye_businesses table by running the migrations:
php artisan migrate
Configuration
By default, the package uses the following environment variables to auto-configure the plugin without modification:
BIRDEYE_API_KEY (default = '')
BIRDEYE_PARENT_BUSINESS_KEY (default = '')
BIRDEYE_API_URL (default = 'https://api.birdeye.com/resources') Can be set to their Mock & Debug URLs as per their API
DB_CONNECTION (default = mysql)
<?php return [ 'api_url' => env('BIRDEYE_API_URL','https://api.birdeye.com/resources'), 'deets' => [ 'api_key' => env('BIRDEYE_API_KEY', ''), 'parent_business_id' => env('BIRDEYE_PARENT_BUSINESS_KEY', '') // Leave blank if using multiple accounts ], 'accounts' => [], 'class_maps' => [], ];
Note that you can always swap out preloaded classes with a project's arbitrary own; the package will use that class in that context.
Using Multiple Accounts
To use multiple accounts, leave config('birdeye.deets.parent_business_id) blank.
Instead, populate config('birdeye.accounts) like the following example
<?php return [ // Other configs left out for brevity 'accounts' => [ 'client-a' => env('BIRD_EYE_CLIENT_A_KEY', 'something'), 'client-b' => 'some-token' ], ];
Finally, run the cron php artisan birdeye:init to migrate the child businesses of each parent.
Migrate the Child Business Data
Run the built-in CLI Command to migrate the accounts' child business into the ecosystem
$ php artisan birdeye:init
You can run this command again to add new accounts' child businesses, by adding to the config and running again
Using the Trait
This package is bundle with a simple trait that when coupled with one of your project's
Eloquent models can link to any of the records in the birdeye_businesses table by
use of an Eloquent relation.
Start by Adding the trait to one of your project's models by including the dependancy and
importing the trait HasBirdEyeBusiness like so -
<?php namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use CapeAndBay\BirdEye\Traits\HasBirdEyeBusiness; class StoreLocation extends Model { use HasBirdEyeBusiness, SoftDeletes; public $birdeye_id_column = 'some_column'; /** Rest of the Logic assumed */ }
Be sure to include $birdeye_id_column where 'some_column' is the foreign key
to birdeye_businesses.internal_id
Note - that in order to complete the relationship you will need to manually
enter the relationship id or roll your own automated method.
This exposes an elequent relation birdeye_business() that an be used in queries.
To use the trait, peep this example and adapt -
<?php use App\LocationModel; $location = LocationModel::find(1); $birdeye_biz = $location->birdeye_business()->first();
The contents of the BirdEye Business are available to be used with rest of the package Library to ping BirdEye to interface with them!
Usage
Check an EndUser Customer into a business
<?php use App\StoreLocation; //Uses HasBirdEyeBusiness trait attached use CapeAndBay\BirdEye\Facades\BirdEye; $location = StoreLocation::find(1); $business = $location->birdeye_business()->first(); $payload = [ 'name' => 'Some Name', 'emailId' => 'someName@test.com', 'phone' => '5555551212', 'smsEnabled' => '1', ]; $birdeye_customer = BirdEye::get('customer', $business->business_id); $checkin_response = $birdeye_customer->checkin($payload); return $checkin_response;
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email angel@capeandbay.com instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.
capeandbay/birdeye 适用场景与选型建议
capeandbay/birdeye 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.53k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「BirdEye」 「Cape and Bay」 「Customer Experience」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 capeandbay/birdeye 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 capeandbay/birdeye 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 capeandbay/birdeye 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alfabank REST API integration
Minecraft skin preview converter (support HD skins and capes)
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
Branded, diagnostic error pages (500, 403, 404, 419, 503) for Filament — native Filament UI, dark mode and translations out of the box.
统计信息
- 总下载量: 1.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-30