Downloads
Stars
Version
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.
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
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.
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.
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
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!
<?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' => '[email protected]',
'phone' => '5555551212',
'smsEnabled' => '1',
];
$birdeye_customer = BirdEye::get('customer', $business->business_id);
$checkin_response = $birdeye_customer->checkin($payload);
return $checkin_response;
Please see the changelog for more information on what has changed recently.
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
MIT. Please see the license file for more information.