PHP code example of alphaolomi / laravel-sarufi
1. Go to this page and download the library: Download alphaolomi/laravel-sarufi 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/ */
alphaolomi / laravel-sarufi example snippets
use Alphaolomi\Laravel\Sarufi\Facades\Sarufi;
$bot = Sarufi::createBot(
name: "Danny bot",
description: "PUT DESCRIPTION HERE",
industry: "YOUR BOT INDUSTRY",
intents: [],
flows: []
);
print_r($bot1);
// Output
// => [
// "intents" => [],
// "user_id" => 54,
// "description" => "PUT DESCRIPTION HERE",
// "industry" => "YOUR BOT INDUSTRY",
// "created_at" => "2022-10-20T14:24:32.862859",
// "name" => "Danny bot",
// "flows" => [],
// "id" => 81,
// "model_name" => "models/24bea90e2ad6f9d279d4fa86795c8ea0.pkl",
// "visible_on_community" => false,
// "updated_at" => "2022-10-20T14:24:32.862872",
// ]
// OR
// From files with intent and metadata/
// Assume you have you file in storage/data/intents.yaml example
$bot2 Sarufi::createFromFile(
intents: storage_path('data/intents.yaml'),
flow: storage_path('data/flow.yaml'),
metadata: storage_path('data/metadata.yaml'
);
print_r($bot);
bash
php artisan vendor:publish --tag="sarufi-config"