PHPackages                             proj4php/proj4php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. proj4php/proj4php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

proj4php/proj4php
=================

A PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS

v2.0.19(8mo ago)1321.7M↑10.1%50[29 issues](https://github.com/proj4php/proj4php/issues)[1 PRs](https://github.com/proj4php/proj4php/pulls)12LGPL-2.1PHPPHP &gt;=7.3CI passing

Since Sep 22Pushed 8mo ago9 watchersCompare

[ Source](https://github.com/proj4php/proj4php)[ Packagist](https://packagist.org/packages/proj4php/proj4php)[ Docs](https://github.com/proj4php/proj4php)[ RSS](/packages/proj4php-proj4php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (46)Used By (12)

[![Build Status](https://camo.githubusercontent.com/0b53953aa98dffc99fb8b9c814ffe7ef81dc539630fce9c0c4da618bfaf39a31/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f70726f6a347068702f70726f6a347068702f6d61737465722e737667)](https://travis-ci.org/proj4php/proj4php)[![Latest Stable Version](https://camo.githubusercontent.com/ffc8423becefa207f75add8629e8bdb82dc35d9caff771339f7483b846a6f814/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70726f6a347068702f70726f6a347068702e737667)](https://packagist.org/packages/proj4php/proj4php)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/34b0eab10c832b7aa1160c11e02f0c9c3ef24d82d858a5ed1973ca258f272b3e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70726f6a347068702f70726f6a347068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/proj4php/proj4php/?branch=master)

proj4php
========

[](#proj4php)

PHP-class for proj4 This is a PHP-Class for geographic coordinates transformation using proj4 definitions, thanks to a translation from Proj4JS.

Updated Requirements and Features
---------------------------------

[](#updated-requirements-and-features)

To keep up with the relentless pace of PHP versions and best practice, the following features are being implemented on this package:

- Namespacing.
- PHP5.4+ syntax (not aiming to be bleeding edge here, just yet)
- [PSR-2 styling](http://www.php-fig.org/psr/psr-2/)
- [PSR-4 autoloader](http://www.php-fig.org/psr/psr-4/)
- [semver](http://semver.org/) release numbers to packagist.org
- Full compatibility with [composer](https://getcomposer.org/)
- Tests to come once the above is implemented.

Legacy branches [proj4php5.2](https://github.com/proj4php/proj4php/tree/proj4php5.2) and [proj4php7.1](https://github.com/proj4php/proj4php/tree/proj4php7.1) will be maintained for older applications that need it.

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

[](#installation)

You can install the package via composer:

```
composer require proj4php/proj4php
```

Using
-----

[](#using)

```
// Use a PSR-4 autoloader for the `proj4php` root namespace.
include("vendor/autoload.php");

use proj4php\Proj4php;
use proj4php\Proj;
use proj4php\Point;

// Initialise Proj4
$proj4 = new Proj4php();

// Create two different projections.
$projL93    = new Proj('EPSG:2154', $proj4);
$projWGS84  = new Proj('EPSG:4326', $proj4);

// Create a point.
$pointSrc = new Point(652709.401, 6859290.946, $projL93);
echo "Source: " . $pointSrc->toShortString() . " in L93 ";

// Transform the point between datums.
$pointDest = $proj4->transform($projWGS84, $pointSrc);
echo "Conversion: " . $pointDest->toShortString() . " in WGS84";

// Source: 652709.401 6859290.946 in L93
// Conversion: 2.3557811127971 48.831938054369 in WGS84
```

There are also ways to define inline projections. Check  and seek for your projection and proj4 or OGC WKT definitions.

Add a new projection from proj4 definition with a name :

```
// add it to proj4
$proj4->addDef("EPSG:27700",'+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs');

// then Create your projections
$projOSGB36 = new Proj('EPSG:27700',$proj4);
```

Or without a name :

```
// Create your projection
$projOSGB36 = new Proj('+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs',$proj4);
```

You can also create your projection from OGC WKT definition :

```
$projOSGB36 = new Proj('PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB_1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4277"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],AUTHORITY["EPSG","27700"],AXIS["Easting",EAST],AXIS["Northing",NORTH]]',$proj4);
```

Developing - How to contribute
------------------------------

[](#developing---how-to-contribute)

Feel free to fork us and submit your changes!

OSGeo community project
-----------------------

[](#osgeo-community-project)

[![ScreenShot](https://camo.githubusercontent.com/ad643bbe46d11ceaadf90ada72bdc22d69fb56ab042b9bbfa6861c2270e2718e/68747470733a2f2f77696b692e6f7367656f2e6f72672f696d616765732f382f38302f4f5347656f5f636f6d6d756e6974792e706e67)](https://camo.githubusercontent.com/ad643bbe46d11ceaadf90ada72bdc22d69fb56ab042b9bbfa6861c2270e2718e/68747470733a2f2f77696b692e6f7367656f2e6f72672f696d616765732f382f38302f4f5347656f5f636f6d6d756e6974792e706e67)

Proj4php is also an OSGeo community project. See [here](https://wiki.osgeo.org/wiki/OSGeo_Community_Projects) for further details.

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance56

Moderate activity, may be stable

Popularity59

Moderate usage in the ecosystem

Community41

Growing community involvement

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 53.7% 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 ~182 days

Recently: every ~149 days

Total

21

Last Release

249d ago

Major Versions

1.0.0 → 2.0.02015-09-26

PHP version history (4 changes)1.0.0PHP &gt;=5.2.0

2.0.0PHP &gt;=5.4.0

2.0.11PHP &gt;=7.2

2.0.13PHP &gt;=7.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/395934?v=4)[Jason Judge](/maintainers/judgej)[@judgej](https://github.com/judgej)

![](https://www.gravatar.com/avatar/121e2882fb8e901f2da0f3b21cead474fd5eea45f4c3b2b56fc36ea020189f7a?d=identicon)[julien2512](/maintainers/julien2512)

---

Top Contributors

[![julien2512](https://avatars.githubusercontent.com/u/838473?v=4)](https://github.com/julien2512 "julien2512 (183 commits)")[![nickolanack](https://avatars.githubusercontent.com/u/8965209?v=4)](https://github.com/nickolanack "nickolanack (59 commits)")[![judgej](https://avatars.githubusercontent.com/u/395934?v=4)](https://github.com/judgej "judgej (45 commits)")[![mwijngaard](https://avatars.githubusercontent.com/u/273701?v=4)](https://github.com/mwijngaard "mwijngaard (7 commits)")[![wired00](https://avatars.githubusercontent.com/u/1291436?v=4)](https://github.com/wired00 "wired00 (5 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (5 commits)")[![swen100](https://avatars.githubusercontent.com/u/1837968?v=4)](https://github.com/swen100 "swen100 (3 commits)")[![kiang](https://avatars.githubusercontent.com/u/47844?v=4)](https://github.com/kiang "kiang (3 commits)")[![lintranex](https://avatars.githubusercontent.com/u/1006190?v=4)](https://github.com/lintranex "lintranex (3 commits)")[![yayann](https://avatars.githubusercontent.com/u/204421?v=4)](https://github.com/yayann "yayann (2 commits)")[![alexandreDavid](https://avatars.githubusercontent.com/u/3982980?v=4)](https://github.com/alexandreDavid "alexandreDavid (2 commits)")[![bbrala](https://avatars.githubusercontent.com/u/3294970?v=4)](https://github.com/bbrala "bbrala (2 commits)")[![gillg](https://avatars.githubusercontent.com/u/5639241?v=4)](https://github.com/gillg "gillg (2 commits)")[![khalyomede](https://avatars.githubusercontent.com/u/15908747?v=4)](https://github.com/khalyomede "khalyomede (2 commits)")[![mykola-yarchuk](https://avatars.githubusercontent.com/u/35385361?v=4)](https://github.com/mykola-yarchuk "mykola-yarchuk (2 commits)")[![patrickbussmann](https://avatars.githubusercontent.com/u/15617021?v=4)](https://github.com/patrickbussmann "patrickbussmann (2 commits)")[![Miloud-H](https://avatars.githubusercontent.com/u/5374946?v=4)](https://github.com/Miloud-H "Miloud-H (1 commits)")[![mohamed-aiman](https://avatars.githubusercontent.com/u/14019247?v=4)](https://github.com/mohamed-aiman "mohamed-aiman (1 commits)")[![illuusio](https://avatars.githubusercontent.com/u/1902756?v=4)](https://github.com/illuusio "illuusio (1 commits)")[![arknoll](https://avatars.githubusercontent.com/u/1660183?v=4)](https://github.com/arknoll "arknoll (1 commits)")

---

Tags

coordinatesgeographicproj4proj4js

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[rinvex/countries

Rinvex Countries is a simple and lightweight package for retrieving country details with flexibility. A whole bunch of data including name, demonym, capital, iso codes, dialling codes, geo data, currencies, flags, emoji, and other attributes for all 250 countries worldwide at your fingertips.

1.7k7.4M48](/packages/rinvex-countries)[data-values/geo

Geographical value objects, parsers and formatters

20631.0k18](/packages/data-values-geo)[jeroendesloovere/distance

Get distance between two locations using PHP.

3462.8k](/packages/jeroendesloovere-distance)[kolyunya/yii2-map-input-widget

Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.

2836.3k4](/packages/kolyunya-yii2-map-input-widget)[lootils/geo

A simple library for dealing with Earth geo coordinate manipulations.

1624.7k1](/packages/lootils-geo)

PHPackages © 2026

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