answear / overseas-bundle
Symfony bundle for Overseas api.
Installs: 13 356
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/answear/overseas-bundle
Requires
- php: ^8.4
- ext-json: *
- guzzlehttp/guzzle: ^7.8.2
- guzzlehttp/psr7: ^2.6
- psr/log: ^1.1||^2.0||^3.0
- symfony/http-kernel: ^7.0.3
- symfony/property-access: ^7.0
- symfony/property-info: ^7.0
- symfony/serializer: ^7.0
- webmozart/assert: ^1.11
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- matthiasnoback/symfony-config-test: ^5.2
- phpro/grumphp: ^2.8
- phpstan/phpstan: ^2.1
- phpstan/phpstan-webmozart-assert: ^2.0
- phpunit/phpunit: ^10.5.27
- roave/security-advisories: dev-master
- symfony/phpunit-bridge: ^7.0.3
README
Overseas integration for Symfony.
Documentation of the API can be found here: https://api.overseas.hr/apiinfo
Installation
- install with Composer
composer require git@github.com:answear/overseas-bundle.git
Answear\OverseasBundle\AnswearOverseasBundle::class => ['all' => true],
should be added automatically to your config/bundles.php file by Symfony Flex.
Setup
- provide required config data:
environmentandapiKey
# config/packages/answear_overseas.yaml answear_overseas: environment: test|prod apiKey: yourApiKey logger: yourCustomLoggerService #default: null
Logger service must implement Psr\Log\LoggerInterface interface.
Usage
Get ParcelShops
@see https://api.overseas.hr/apiinfo#parcelshops
/** @var \Answear\OverseasBundle\Service\ParcelShopsService $parcelShopService **/ $parcelShopService->get();
will return \Answear\OverseasBundle\Response\DTO\ParcelShop[] array.
Get Places
@see https://api.overseas.hr/apiinfo#places
$zipCode = 12345; $name = 'name'; $approx = true; /** @var \Answear\OverseasBundle\Service\PlacesService $placesService **/ $placesService->get($zipCode, $name, $approx);
will return \Answear\OverseasBundle\Response\DTO\Place[] array narrowed down to params. or simply
$placesService->get();
to get all places.
Error handling
Answear\OverseasBundle\Exception\ServiceUnavailableExceptionfor allGuzzleExceptionMalformedResponseExceptionfor partner other errorsAnswear\OverseasBundle\Exception\BadRequestExceptionif validation failed or for error response
Final notes
Feel free to open pull requests with new features, improvements or bug fixes. The Answear team will be grateful for any comments.