think.studio/laravel-loqate-api

Loqate api integration for laravel

1.1.0 2023-08-20 05:48 UTC

This package is auto-updated.

Last update: 2024-12-20 08:40:44 UTC


README

Packagist License Packagist Version Total Downloads Build Status Code Coverage Scrutinizer Code Quality

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)

Credits

  • Think Studio