think.studio / laravel-iprosoftware-api
Laravel wrapper for IproSoftware Api
4.1.0
2024-02-09 12:35 UTC
Requires
- php: ^8.1
- illuminate/support: ^10.0|^11.0
- think.studio/ipro-software-api-php: ^4.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.49
- mockery/mockery: ^1.6
- orchestra/testbench: ^8.0
- phpunit/phpunit: ^10.5
- psalm/plugin-laravel: ^2.8
- vimeo/psalm: ^5.21
README
Note: This package is an wrapper for laravel-iprosoftware-api. All predefined api methods names you can find here
Installation
You can install the package via composer:
composer require think.studio/laravel-iprosoftware-api
Usage
Using predefined methods:
use LaravelIproSoftwareApi\IproSoftwareFacade as IproSoftware; /** @var \LaravelIproSoftwareApi\IproApiResponse $response */ $response = IproSoftware::getBookingRulesList(); $bookingRules = $response->json();
Add custom methods (you can use any service provider):
use LaravelIproSoftwareApi\IproSoftwareFacade IproSoftwareFacade::mergeMethods([ 'getReport' => ['get', 'property/%s/reports/1'], 'getTasks' => ['get', 'tasks'], ]); /** @var \LaravelIproSoftwareApi\IproApiResponse $response */ $response = IproSoftwareFacade::getReport($selectedProperty->getKey());
Direct call using GuzzleHttp:
use LaravelIproSoftwareApi\IproSoftwareFacade $propertyId = 22; /** @var \LaravelIproSoftwareApi\IproApiResponse $response */ $response = IproSoftwareFacade::httpClient()->get("property/$propertyId/reports/1", [ 'query' => [ 'foo' => 'bar', ], ]);
.env
IPROSOFTWARE_CLIENT_ID="my-client-id" IPROSOFTWARE_CLIENT_SECRET="my-secret-key" IPROSOFTWARE_API_HOST="http://myapp.i-pro3.co.uk"
Config Files
In order to edit the default configuration for this package you may execute:
php artisan vendor:publish --provider="LaravelIproSoftwareApi\ServiceProvider"
Since you will typically need to overwrite the assets every time the package is updated, you may use the --force
flag.
Testing
composer test