laravel-easyoffice-api maintained by creso
Description
Laravel EasyOffice API wrapper
Author
Last update
2023/09/26 16:42
(dev-feature/laravel-10-support)
License
Downloads
31
Tags
Laravel EasyOffice API wrapper
Laravel wrapper around the EasyOffice API.
Installation
You can install the package via composer:
composer require creso/laravel-easyoffice-api
You can publish the config file with:
php artisan vendor:publish --tag="easyoffice-api-config"
This is the contents of the published config file:
return [
/**
* The base url of the EasyOffice API.
*/
'base_url' => env('EASY_OFFICE_API_BASE_URL'),
/**
* The API token to authenticate with the EasyOffice API.
*/
'api_token' => env('EASY_OFFICE_API_TOKENS'),
/**
* Enable or disable api response cache. (not used yet)
*/
'enable_cache' => env('EASY_OFFICE_ENABLE_CACHE'),
/**
* The cache lifetime of an api response in seconds. (not used yet)
*
* This will only be used in case no specific cache lifetime is configured for the api type
* in the config setting below.
*/
'default_cache_liftime' => 60 * 60, // 1h
/**
* The cache lifetime of an api response in seconds for a given api type. (not used yet)
*/
'cache_lifetime' => [
'webcontentParts' => 60 * 60 * 24, // 24h
],
];
Usage
Facade vs Dependency injection vs app helper
# Using the facade
EasyOfficeApi::webcontentParts()->all();
# Dependency injection
use Creso\LaravelEasyofficeApi\EasyofficeApi;
class MyClass
{
public function __construct(private EasyofficeApi $easyofficeApi)
{
}
public function __invoke()
{
$this->easyofficeApi->webcontentParts()->all();
}
}
# Using the Laravel app helper
use Creso\LaravelEasyofficeApi\EasyofficeApi;
app(EasyofficeApi::class)->webcontentParts()->all();
Webcontent parts
# Get all webcontent parts
EasyOfficeApi::webcontentParts()->all();
# Get all webcontents parts, but filterd by uuid
EasyOfficeApi::webcontentParts()->all(['uuid' => 'a-full-or-partial-uuid-to-filter-on']);
# A specific webcontent part by uuid
EasyOfficeApi::webcontentParts()->get('729bc31d-ab1b-4cfb-9dab-b5419bdc92ca');
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.