1. Go to this page and download the library: Download ibagayoko/rc_sdk_php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ibagayoko / rc_sdk_php example snippets
use IBagayoko\RasaCoreSdk\Endpoint;
use IBagayoko\RasaCoreSdk\Action;
use IBagayoko\RasaCoreSdk\Events;
class PhpAction extends Action
{
public function name()
{
return "action_php";
}
public function run($dispatcher, $tracker, $domain)
{
$dispatcher->utter_message("Hello From Php");
return [Events::SlotSet("php", "up")];
}
}
// create a new endpoint with an array of customs actions
$endpoint = new Endpoint([PhpAction::class]);
switch ($_SERVER["PATH_INFO"]) {
case '/health':
$endpoint->health();
break;
case '/webhook':
$endpoint->webhook();
default:
break;
}
use IBagayoko\RasaCoreSdk\Endpoint;
use IBagayoko\RasaCoreSdk\Action;
use IBagayoko\RasaCoreSdk\Events;
class PhpAction extends Action
{
public function name()
{
return "action_php";
}
public function run($dispatcher, $tracker, $domain)
{
$dispatcher->utter_message("Hello From Php");
return [Events::SlotSet("php", "up")];
}
}
// create a new endpoint with an array of customs actions
$endpoint = new Endpoint([PhpAction::class]);
Route::get('/health', function () use($endpoint)
{
return $endpoint->health();
});
Route::post('/webhook', function () use($endpoint)
{
return $endp->webhook();
});
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.