PHP code example of hsyir / simotel-laravel-connect
1. Go to this page and download the library: Download hsyir/simotel-laravel-connect 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/ */
namespace App\Listeners;
class UpdateCallCdrData
{
/**
* Handle the event.
*
* @param object $event
* @return void
*/
public function handle($event)
{
$cdrData = $event->apiData;
//
}
}
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Hsy\SimotelConnect\SimotelEventApi;
use Illuminate\Http\Request;
class SeaController extends Controller
{
public function dispatchEvent(Request $request)
{
$simotelEventApi = new SimotelEventApi;
$simotelEventApi->dispatchSimotelEvent($request->all());
}
}
namespace App\Classes;
use Hsy\SimotelConnect\SmartApiCommands;
class SmartApiMethodsRepo
{
use SmartApiCommands;
// نام متد باید مساوی با نام کامپوننت SmartApi در نقشه تماس سیموتل باشد.
public function select_queue($apiData)
{
$this->cmdGetData("SelectQueue", 4, 2);
$this->cmdExit("1");
if(true)
return $this->okResponse();
//else
return $this->errorResponse();
}
}
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Hsy\SimotelConnect\SmartApi;
use Illuminate\Http\Request;
class SmartApiController extends Controller
{
public function call(Request $request)
{
$smartApi = new SmartApi;
$response = $smartApi->callApi($request->all());
return response()->json($response);
}
}