fbarachino/kalliopepbx
最新稳定版本:1.0.1
Composer 安装命令:
composer require fbarachino/kalliopepbx
包简介
Helper to consume Kalliope's RestAPI
README 文档
README
Package per Laravel per utilizzare le RestAPI del Kalliope PBX
Usage
To use this package for laravel, follow the steps below:
-
Install the package via Composer:
composer require fbarachino/kalliopepbx
-
Publish the config file:
php artisan vendor:publish --tag=kalliopepbx-config
and edit it with correct values.
-
Initialize and configure the library as needed (for example):
... use Illuminate\Support\Facades\Storage; use fbarachino\kalliopepbx\KalliopePbx; class RestApiCall { public static function getSerialNumber() { $kalliope = new KalliopePbx(); $response = $kalliope->sendRequest('rest/dashboard/serialNumber','GET'); return $response; } // remeber to execute 'php artisan storage:link' public static function backup($filename, $description) { $kalliope = new KalliopePbx(); $firmware = $kalliope->sendRequest('/rest/dashboard/firmwareVersion','GET'); $data = [ 'backup'=> [ 'filename' => $filename, 'comment' => $description ], ]; $response = json_decode($kalliope->sendRequest('rest/backup/create/'.$firmware,'POST',$data); return Storage::disk('local')->put('/public/backup/kalliope/'.$filename.'.bak', $response); } } ...
-
You can use the helper as:
$kalliope->sendRequest($url,$method,$data);
Where
$urlis the URL of the API request,$methodis the method (GET,POST,PUT,PATCH,DELETE), and$datais the array of fields.
From version 1.0.1 you can also instantiate directly if you don't want to use the config/kalliopepbx.php file:
... $kalliope = new KalliopePbx($address,$port,$protocol,$username,$password); ...
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-14