بي إتش بي
PHP 8.1+ with ext-curl, ext-json, ext-mbstring
A PSR-4 Composer package with one API class per operation family, a typed exception, and no framework dependency. Source is published in its own repository, so no private access is required.
Install
Composer
composer require bardiyamap/sdk:^0.1.0Published packagehttps://packagist.org/packages/bardiyamap/sdkSource repositoryhttps://github.com/EngMohamed05/bardiya-php
What it supports
- Every public Maps operation
- Every public Tracking operation
- Webhooks and client tokens
- Laravel-friendly construction
Initialise the client
php
use BardiyaMap\Sdk\BardiyaClient;
$client = BardiyaClient::create([
'mapsApiKey' => getenv('BARDIYA_MAPS_KEY'),
'trackingApiKey' => getenv('BARDIYA_TRACKING_KEY'),
]);
$places = $client->places()->searchPlaces('coffee', 30.0444, 31.2357, 2000, null, null, 5, 'en');
echo $places->getCount();Typical operation
Error inspection
php
use BardiyaMap\Sdk\BardiyaException;
try {
$client->places()->searchPlaces('coffee');
} catch (BardiyaException $failure) {
$failure->getStatusCode(); // 429
$failure->getCode(); // "rate_limited"
$failure->getRequestId();
}Things that catch people out
- Install only from Packagist. A composer.json that adds a vcs or path repository for this package is out of date.
- The client is synchronous and stateless between calls; share one instance per request.
