think.studio / laravel-loqate-api
Loqate api integration for laravel
1.1.0
2023-08-20 05:48 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.16
- orchestra/testbench: ^8.5
- phpunit/phpunit: ^10.1
- psalm/plugin-laravel: ^2.8
- vimeo/psalm: ^5.11
README
Installation
You can install the package via composer:
composer require think.studio/laravel-loqate-api
Configuration in .env
// config/services.php
'loqate' => [
'key' => env('LOQATE_API_KEY'),
],
LOQATE_API_KEY="AA11-AA11-AA11-AA11"
Usage
Simple call
LaravelLoqate\Loqate::captureInteractiveFind()->setText('CT15 5LS')->setIsMiddleware()->call()->json();
Set you api class
use LaravelLoqate\APIs\AbstractAPI; class MyCaptureInteractiveFind extends AbstractAPI { /** * @inheritDoc */ public function basePath(): string { return 'Capture/Interactive/Find/v1.1'; } } $response = LaravelLoqate\Loqate::api(MyCaptureInteractiveFind::class)->setRequestField('Text', 'CT15 5LS')->setRequestField('IsMiddleware', true)->call(); $response->json('Items');
You can also specify your response wrapper (extends AbstractResponse)