uxf/smart-address-sdk

1.0.0 2023-02-09 16:43 UTC

This package is auto-updated.

Last update: 2024-12-15 16:27:12 UTC


README

Install

$ composer req uxf/smart-address-sdk
// bundles.php
return [
    UXFCoreBundle::class => ['all' => true];
    UXFHydratorBundle::class => ['all' => true];
    SmartAddressBundle::class => ['all' => true];
];

Config (optional)

// packages/smart_address.php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $containerConfigurator->extension('smart_address', [
        'base_url' => 'https://www.smart-address.cz', // default value
    ]);
};

Usage

use SmartAddress\SmartAddressService;
use SmartAddress\Http\Request\SearchQueryRequest;
use SmartAddress\Http\Request\SearchZipRequestQuery;

class LocationService
{
    public function __construct(private readonly SmartAddressService $service)
    {
    } 

    public function run()
    {
        $address = $service->getAddress(23713011);
        $address = $service->getExtendedAddress(23713011);
        $addresses = $service->search(new SearchQueryRequest(term: 'Sovova 584'));
        $addresses = $service->searchByZip(new SearchZipRequestQuery('46014'));
    }
}