anwar / smaregi
Smaregi 应用 API 实现用于 Laravel
1.02
2024-08-20 17:37 UTC
Requires
- php: >=8.0
- guzzlehttp/guzzle: ^7.2
README
composer require anwar/smaregi
环境变量
要使用这个出色的包,您需要将以下变量添加到您的 .env
文件中
SMAREGI_CONTRACT_ID=
SMAREGI_CLIENT_ID=
SMAREGI_CLIENT_SECRET=
SMAREGI_BASE_URL_FOR_TOKEN=
SMAREGI_BASE_URL=
示例
<?php namespace Anwar\Smaregi\Controller; use Anwar\Smaregi\SmaregiConnection; use App\Http\Controllers\Controller; class SmaregiController extends Controller { protected SmaregiConnection $connection; /** * @param SmaregiConnection $connection */ public function __construct(SmaregiConnection $connection){ $this->connection = $connection; } /** * GET Method example */ public function getCategories(){ return $this->connection->get('pos/categories', [ 'categoryName' => "Test categoryName by pos developer2" ]); } /** * POST method Example */ public function storeCategories(){ return $this->connection->post('pos/categories', [ "categoryName" => "Test Category" ]); } /** * DELETE method Example */ public function deleteCategory($id){ return $this->connection->delete('pos/categories', $id); } /** * PATCH method Example */ public function updateCategory($id){ return $this->connection->patch('pos/categories', $id, [ "categoryName" => "Test Category Updated" ]); } }