peter9x/laravel-bc
最新稳定版本:v0.1.3
Composer 安装命令:
composer require peter9x/laravel-bc
包简介
Laravel package for Microsoft Business Central API
README 文档
README
Laravel Business Central
A Laravel package for integrating with the Microsoft Business Central API.
Installation
- Install the package via Composer:
composer require peter9x/laravel-bc
- Publish the configuration file:
php artisan vendor:publish --provider="Mupy\\BusinessCentral\\BusinessCentralServiceProvider" --tag=config
- Add the following to your
.envfile:
Note:
BC_COMPANY_IDis optional.
If not set, you will need to select a company in your code after retrieving the list of companies (see the usage example).
BC_CLIENT_ID=your-client-id BC_CLIENT_SECRET=your-client-secret BC_TENANT_ID=your-tenant-id # Optional: if not set, select the company in your script BC_COMPANY_ID=your-company-id BC_ENVIRONMENT=sandbox
Usage
use Mupy\BusinessCentral\Facades\BusinessCentral; use Mupy\BusinessCentral\EndPoint\Company; use Mupy\BusinessCentral\EndPoint\SalesInvoices; $api = BusinessCentral::getClient(); // Change the environment dynamically if needed $api->selectEnv('sandbox'); try { $result = $api->get(Company::class); if ($result->success()) { foreach ($result->data() as $entry) { // Select the company dynamically if BC_COMPANY_ID is not set in .env $company = $api->useCompany($entry['id']); $company->get(SalesInvoices::class); } } } catch (\Throwable $th) { // Handle exceptions as needed }
统计信息
- 总下载量: 112
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-13