PHPackages                             mehrdad-dadkhah/open-street-map-api - 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. mehrdad-dadkhah/open-street-map-api

ActiveLibrary[API Development](/categories/api)

mehrdad-dadkhah/open-street-map-api
===================================

Open Street Map (OSM) service to call and get results of APIs

1.0.0(6y ago)42.3k1[2 issues](https://github.com/Mehrdad-Dadkhah/open-street-map-api/issues)PHPPHP &gt;=7.0.0

Since Jan 2Pushed 6y ago2 watchersCompare

[ Source](https://github.com/Mehrdad-Dadkhah/open-street-map-api)[ Packagist](https://packagist.org/packages/mehrdad-dadkhah/open-street-map-api)[ Docs](https://github.com/Mehrdad-Dadkhah/open-street-map-api)[ RSS](/packages/mehrdad-dadkhah-open-street-map-api/feed)WikiDiscussions master Synced 2d ago

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

Open Street Map API service
===========================

[](#open-street-map-api-service)

[![Packagist Version](https://camo.githubusercontent.com/26a7c97f5958bc562bd0a5a77e1e688f4135698f3de823c247237638a638ac9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4d6568726461642d4461646b6861682f6f70656e2d7374726565742d6d61702d6170692e7376673f7374796c653d666c61742d737175617265)](https://github.com/Mehrdad-Dadkhah/open-street-map-api)

Open Street Map (OSM) service to call and get results of APIs.

Will add new services in future.

System requirements
-------------------

[](#system-requirements)

only with &gt;=7.0.0

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

[](#installation)

```
composer require mehrdad-dadkhah/open-street-map-api

```

Usage
-----

[](#usage)

with coordinates option:

```
use MehrdadDadkhah\OSM\OSMRouteService;

$osm = new OSMRouteService;
        $osm->addCoordinate(35.6998, 51.3310)
            ->addCoordinate(35.7581, 51.5087);

        echo $osm->getDuration()->getWithUnit(\MehrdadDadkhah\OSM\Types\Duration::MINUTE_UNIT); // or 'minute'
        echo $osm->getDistance()->getWithUnit(\MehrdadDadkhah\OSM\Types\Distance::KILOMETER_UNIT); // or 'kilometer'
```

with polyline option:

```
use MehrdadDadkhah\OSM\OSMRouteService;

$osm = new OSMRouteService;
        $osm->setPolyline('ofp_Ik_vpAilAyu@te@g%60E');

        echo $osm->getDuration()->getWithUnit(\MehrdadDadkhah\OSM\Types\Duration::MINUTE_UNIT);
        echo $osm->getDistance()->getWithUnit(\MehrdadDadkhah\OSM\Types\Distance::KILOMETER_UNIT);
```

If you have local [osm-backend server](https://hub.docker.com/r/peterevans/osrm-backend), you can change base url by:

```
        $osm->setBaseUrl('http://your-url.local');
```

Reverse location with osm
-------------------------

[](#reverse-location-with-osm)

```
$result = $locationService->setBaseUrl('CAN-SET-URL') // it's optional
        ->setPoint($lat, $long)
        ->setLanguage('fa')
        ->reverseLocation();
```

Geocodeing
----------

[](#geocodeing)

```
        use use MehrdadDadkhah\OSM\NominatimSearchPlaceService;
        .
        .
        .
        $nomiLocationService = new NominatimSearchPlaceService();
        $nomiLocationService->setLimit(1)
            ->enableAddressDetails()
            ->setSearchQuery($city->name) // name of city
            ->search();
```

Self hosted
-----------

[](#self-hosted)

If you want self host osrm-backend and notinimate can copy and custom docker-compose.yml in docker directory.

Acknowledgments
---------------

[](#acknowledgments)

- Thanks to [osrm-backend](https://github.com/Project-OSRM/osrm-backend/blob/master/docs/http.md)

Uses:
-----

[](#uses)

- [guzzlehttp/guzzle](https://github.com/guzzle/guzzle)

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~81 days

Total

4

Last Release

2493d ago

Major Versions

0.3.0 → 1.0.02019-09-03

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3860685?v=4)[Mehrdad-Dadkhah](/maintainers/Mehrdad-Dadkhah)[@Mehrdad-Dadkhah](https://github.com/Mehrdad-Dadkhah)

---

Top Contributors

[![Mehrdad-Dadkhah](https://avatars.githubusercontent.com/u/3860685?v=4)](https://github.com/Mehrdad-Dadkhah "Mehrdad-Dadkhah (7 commits)")

---

Tags

apimaproutegeometrygeodistanceduration

### Embed Badge

![Health badge](/badges/mehrdad-dadkhah-open-street-map-api/health.svg)

```
[![Health](https://phpackages.com/badges/mehrdad-dadkhah-open-street-map-api/health.svg)](https://phpackages.com/packages/mehrdad-dadkhah-open-street-map-api)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

617.2M37](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M12](/packages/checkout-checkout-sdk-php)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[volcengine/volcengine-php-sdk

118.7k](/packages/volcengine-volcengine-php-sdk)

PHPackages © 2026

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