https://github.com/vohinc/laravel-botanalytics
A Botanalytics Wrapper for Laravel
https://github.com/vohinc/laravel-botanalytics
botanalytics botanalytics-php laravel laravel-botanalytics php
Last synced: 5 months ago
JSON representation
A Botanalytics Wrapper for Laravel
- Host: GitHub
- URL: https://github.com/vohinc/laravel-botanalytics
- Owner: vohinc
- License: mit
- Created: 2017-01-24T14:15:53.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-26T02:48:57.000Z (over 9 years ago)
- Last Synced: 2025-08-04T18:54:45.427Z (10 months ago)
- Topics: botanalytics, botanalytics-php, laravel, laravel-botanalytics, php
- Language: PHP
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Botanalytics
[](https://travis-ci.org/vohinc/laravel-botanalytics)
[](https://styleci.io/repos/79917842)
A Botanalytics Wrapper for Laravel
[Botanalytics](https://botanalytics.co/) is a bot analytics service, improves Human-to-Bot interaction.
## Install
### Composer
To get the latest version
```shell
composer require vohinc/laravel-botanalytics
```
### Add Provider
Include the provider within `config/app.php`
```php
'providers' => [
...
Vohinc\LaravelBotanalytics\BotanalyticsServiceProvider::class,
...
]
```
### Publish Configuration
```shell
php artisan vendor:publish --provider=Vohinc\LaravelBotanalytics\BotanalyticsServiceProvider --tag=config
```
## Config
### Set Botanalytics Token
Add your botanalytics token to `.env`
```
BOTANALYTICS_TOKEN=botanalytics-token
```
## Usage
### Incoming Message
```php
all();
if (array_get($body, 'object') === 'page') {
BotanalyticsFacade::facebook()->request([
'recipient' => null,
'message' => $body,
]);
}
return $next($request);
}
}
```
### Out-going Message
```php
[
'id' => 'Sender ID',
],
'message' => [
'text' => 'hello, world!',
],
];
// response $message to Facebook
// Send to botanalytics
BotanalyticsFacade::facebook()->request([
'recipient' => array_get($message, 'recipient.id'),
'message' => array_get($message, 'message'),
]);
}
}
```
## License
This package is licensed under the [MIT license](https://github.com/vohinc/laravel-botanalytics/blob/master/LICENSE).