PHPackages                             barikoi/barikoiapis - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. barikoi/barikoiapis

ActiveLibrary[API Development](/categories/api)

barikoi/barikoiapis
===================

A comprehensive Laravel package for integrating Barikoi API - Bangladesh's leading location data provider

v2.0.0(4mo ago)3170MITPHPPHP ^8.1|^8.2|^8.3CI passing

Since Jan 6Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/barikoi/bkoi-php-library)[ Packagist](https://packagist.org/packages/barikoi/barikoiapis)[ RSS](/packages/barikoi-barikoiapis/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (5)Used By (0)

Barikoi Laravel Package
=======================

[](#barikoi-laravel-package)

A comprehensive Laravel package for integrating [Barikoi API](https://barikoi.com) - Bangladesh's leading location data provider.

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE.md)

Features
--------

[](#features)

- 🗺️ **Location Services**: Geocoding, Reverse Geocoding, Autocomplete, Place Search, Place Details, Nearby Places, Check nearby location within a specified radius, Snap to Road
- 🛣️ **Routing**: Calculate Detailed Route and Route Overview
- ⚠️ **Error Handling**: User-friendly exceptions with actionable error messages

---

Installation
------------

[](#installation)

```
composer require barikoi/barikoiapis
```

Configuration
-------------

[](#configuration)

1. Publish the configuration file:

```
php artisan vendor:publish --provider="Barikoi\BarikoiApis\BarikoiServiceProvider" --tag="config"
```

2. Add your Barikoi API credentials to `.env`:

```
BARIKOI_API_KEY=your_api_key_here
```

Get your API key from [Barikoi](https://developer.barikoi.com).

---

Quick Start
-----------

[](#quick-start)

```
use Barikoi\BarikoiApis\Facades\Barikoi;

// 1. Reverse geocoding with rich options
$options = [
    'country_code' => 'BD',
    'district' => true,
    'post_code' => true,
    'country' => true,
    'sub_district' => true,
    'union' => true,
    'pauroshova' => true,
    'location_type' => true,
    'division' => true,
    'address' => true,
    'area' => true,
    'bangla' => true,
    'thana' => true,
];
$reverse = Barikoi::reverseGeocode(90.3572, 23.8067, $options);

$autocomplete=Barikoi::autocomplete('barikoi', [
                'bangla'       => true,
                'city'         => 'dhaka',
                'sub_area'     => true,
                'sub_district' => true,
            ]);

// Geocode (Rupantor) - returns stdClass (object)
$geocoded = Barikoi::geocode('shawrapara');

// Search place by text
$places = Barikoi::searchPlace('Dhanmondi');

// Get place details by place_code - returns stdClass (object)
$placeDetails = Barikoi::placeDetails('BKOI2017', [
    'session_id' => '4c47157f-22d6-4689-abdf-c9f81eb43ae4'
]);

// Nearby search
$nearby = Barikoi::nearby(90.38305163, 23.87188719, 0.5, 2);

// Check nearby (geofence check)
$checkNearby = Barikoi::checkNearby(23.8067, 90.3572, 23.8070, 90.3575, 50);

// Snap to nearest road
$snapped = Barikoi::snapToRoad(23.8067, 90.3572);

// Detailed route between two points (returns stdClass object with "trip")
$route = Barikoi::calculateRoute([
    'start' => ['longitude' => 90.36558776260725, 'latitude' => 23.791645065364126],
    'destination' => ['longitude' => 90.3676300089066, 'latitude' => 23.784715477921843],
], [
    'type' => 'vh',           // 'vh' (motorcycle only) or 'gh' (all profiles)
    'profile' => 'motorcycle'  // 'bike', 'motorcycle', or 'car'
]);

// Simple route overview (returns stdClass object)
$overview = Barikoi::routeOverview([
    ['longitude' => 90.3572, 'latitude' => 23.8067],
    ['longitude' => 90.3680, 'latitude' => 23.8100],
], [
    'profile' => 'car',
    'geometries' => 'polyline',
]);
```

---

Documentation
-------------

[](#documentation)

### 📚 API Documentation

[](#-api-documentation)

Complete documentation with parameters, conditions, and error handling for each API:

API ServiceDocumentation**Location Services**[docs/location-api.md](docs/location-api.md)- Reverse GeocodingConvert coordinates to address- Geocoding (Rupantor)Convert address to coordinates- AutocompletePlace suggestions- Search PlaceText-based place search- Place DetailsGet Place Details- Nearby SearchFind places within radius- Check NearbyCheck nearby location within a specified radius- Snap to RoadCorrect GPS coordinates**Routing Services**[docs/routing-api.md](docs/routing-api.md)- Route OverviewSimple route calculation- Detailed RouteTurn-by-turn route with options---

Usage
-----

[](#usage)

### Using Facade (Recommended)

[](#using-facade-recommended)

```
use Barikoi\BarikoiApis\Facades\Barikoi;

$reverse = Barikoi::reverseGeocode(90.3572, 23.8067); // returns stdClass (object)
$places = Barikoi::autocomplete('restaurant');
```

---

Error Handling
--------------

[](#error-handling)

The package provides comprehensive error handling with user-friendly messages.

### Exception Types

[](#exception-types)

**`BarikoiValidationException`** - Validation errors (400)

- Invalid coordinates
- Missing parameters
- Invalid input values

**`BarikoiApiException`** - API errors (401, 404, 429, 500, etc.)

- 401: Invalid API key
- 404: Resource not found
- 429: Rate limit exceeded
- 500: Server error

### Basic Usage

[](#basic-usage)

```
use Barikoi\BarikoiApis\Facades\Barikoi;
use Barikoi\BarikoiApis\Exceptions\BarikoiApiException;
use Barikoi\BarikoiApis\Exceptions\BarikoiValidationException;

try {
    $result = Barikoi::reverseGeocode(90.3572, 23.8067);

} catch (BarikoiValidationException $e) {
    // Handle validation errors (400)
    echo "Invalid input: " . $e->getMessage();

} catch (BarikoiApiException $e) {
    // Handle API errors (401, 404, 500, etc.)
    echo "API Error: " . $e->getMessage();
}
```

### Error Messages

[](#error-messages)

CodeMessage400`Validation Error: Invalid coordinates. Please check your input parameters.`401`Authentication Failed: Invalid API key. Please verify your API key is correct.`404`Not Found: Resource not found. The requested resource or endpoint does not exist.`429`Rate Limit Exceeded: Too many requests. Please reduce the number of requests...`500`Server Error: Internal Server Error. The Barikoi API is experiencing issues...`### Getting Error Details

[](#getting-error-details)

```
catch (BarikoiValidationException $e) {
    $message = $e->getMessage();              // User-friendly message
    $statusCode = $e->getCode();              // HTTP status code
}
```

See individual API documentation for specific error conditions and solutions.

---

Examples
--------

[](#examples)

### Example 1: Get Address from GPS

[](#example-1-get-address-from-gps)

```
public function getAddress(Request $request)
{
    try {
        $result = Barikoi::reverseGeocode(
            $request->longitude,
            $request->latitude,
            ['district' => true, 'bangla' => true]
        );

        return response()->json([
            'address' => $result->place->address,
            'district' => $result->place->district,
        ]);
    } catch (BarikoiApiException $e) {
        return response()->json(['error' => $e->getMessage()], $e->getCode());
    }
}
```

### Example 2: Calculate Route

[](#example-2-calculate-route)

```
public function calculateRoute(Request $request)
{
    try {
        $route = Barikoi::calculateRoute([
            'start' => ['longitude' => $request->start_longitude, 'latitude' => $request->start_latitude],
            'destination' => ['longitude' => $request->destination_longitude, 'latitude' => $request->destination_latitude],
        ], [
            'type' => 'vh',
            'profile' => 'motorcycle'
        ]);

        return $route;
    } catch (BarikoiApiException $e) {
        return response()->json(['error' => 'Route calculation failed'], 500);
    }
}
```

---

API Reference
-------------

[](#api-reference)

For detailed Barikoi API documentation, visit [Barikoi API Documentation](https://docs.barikoi.com/api).

---

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for version history.

---

License
-------

[](#license)

The MIT License (MIT). See [License File](LICENSE.md) for more information.

---

Credits
-------

[](#credits)

- [Barikoi Technologies Limited](https://www.barikoi.com/)
- Package developed for easy Laravel integration

---

Support
-------

[](#support)

For issues or questions:

- Create an issue on GitHub
- Check the detailed API documentation in `docs/` folder
- Contact  for any support

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance75

Regular maintenance activity

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~361 days

Total

3

Last Release

134d ago

Major Versions

v1.1.1 → v2.0.02025-12-29

PHP version history (2 changes)v1.1.0PHP ^7.4|^8.0

v2.0.0PHP ^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8e69bd523b34da81c3adbbaa9b7a300cf6f28d85dd9cb289ef7d1a77c88eece?d=identicon)[barikoi](/maintainers/barikoi)

---

Top Contributors

[![rakibul-hasan-1](https://avatars.githubusercontent.com/u/32975517?v=4)](https://github.com/rakibul-hasan-1 "rakibul-hasan-1 (35 commits)")[![dasraju](https://avatars.githubusercontent.com/u/28943733?v=4)](https://github.com/dasraju "dasraju (5 commits)")

---

Tags

laravelgeocodingroutingmapslocationbangladeshgeofencingbarikoi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/barikoi-barikoiapis/health.svg)

```
[![Health](https://phpackages.com/badges/barikoi-barikoiapis/health.svg)](https://phpackages.com/packages/barikoi-barikoiapis)
```

###  Alternatives

[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
