A laravel package for RecastAI based on the official PHP SDK Recast.AI recastai/sdk_php from Marian André <[email protected]>
kanian/recastai_sdk_laravel is a Laravel package for a laravel package for recastai based on the official php sdk recast.ai recastai/sdk_php from marian andré <[email protected]>.
It currently has 0 GitHub stars and 1.051 downloads on Packagist.
Install it with composer require kanian/recastai_sdk_laravel.
Discover more Laravel packages by kanian
or browse all Laravel packages to compare alternatives.
Last updated
Based on the official PHP SDK Recast.AI recastai/sdk_php it provides a convenient service provider for the SDK.
composer create-project laravel/laravel myproject dev-developcd myprojectcomposer require kanian/recastai_sdk_laravel=dev-masterphp artisan vendor:publishNow you are ready to use the \RecastAI Facace, e.g. open routes/web.php:
<?php
Route::get('tryrecastai', function(Request $request) {
return \RecastAI::get()
->request
->analyseText('hello');
});
Or in a controller:
<?php
namespace App\Http\Controllers;
class TryRecastAIController extends Controller
{
/**
* Just Testing RecastAI
*
* @return Response
*/
public function __invoke()
{
$client = \RecastAI::get();
$res = $client->request->analyseText('hello');
if ($res->intent()->slug == 'greetings') {
// Do your code
}
return view('testrecastai', ['text' => $res->source, 'answer'=>"Yello!"]);
}
}
To override the default configuration add the following parameters to your .env file.
RECASTAI_TOKEN = YOUR_RECASTAI_REQUEST_TOKEN
LANGUAGE = 'en'