Download the PHP package academe/proj4php without Composer

On this page you can find all versions of the php package academe/proj4php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.


After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

All versions of proj4php with dependencies

Informations about the package proj4php

Proj4JS Port to PHP5.3

Note: I'll fix any issues found here by Pull Request, and keep this package here, but it is not being actively developed. There is a full Proj4JS PHP port here - packagist - with some great composer-based features, that is derived from proj4JS. I am also experimenting with some alternative approaches here that will hopefully feed into proj4php. This package was started when proj4JS was a lot newer and less complete. Both that and proj4php have kept moving forward and surpassed it in support for a larger range of projections.

I just wanted some simple conversions and transforms, and ended up with this. I must be a masachist.

Proj4JS has split out the MGRS handling to a separate module, possibly due to licensing issues. It is included in this library for the time-being, but has had a substantial refactor and rewrite from the original.

The main Mgrs classes have a mix of static methods that return new objects (Mgrs, LatLong, Square, Utm objects) and methods that operate on the current object. I intend to make it a little clearer which method does what. It has just inherited much of this from the JavaScript library, and partly from my learning curve in how the JavaScript library works.


namespace: Academe\Proj4Php\Mgrs

The LatLong and Square classes implement minimal interfaces to support the UTM and MGRS classes as a standalone module (nothing in Academe\Proj4Php\Mgrs depends on anything else). This may change, depending on whether Mgrs is split off into a separate library, or coupled more tightly with the other coordinate classes on the main Proj4Php library. It will probably depend on inherited licenses.

The LatLong class holds a latitude and longitude.

$latitude = 53.0;
$longitude = -5.5;

$lat_long = new LatLong($latitude, $longitude);
$lat_long = new LatLong(array($latitude, $longitude));

The Square class holds two LatLong classes to mark the opposite corners of the bounding box.

$square = new Square($lat_long_bottom_left, $lat_long_top_right);

The Utm class holds a UTM coordinate.

// From base UTM values.
$utm = new Utm($northing, $easting, $zone_number, $zone_letter);

// From latitude/longitude coordinates (WGS84 ellipsoid).
$utm = Utm::fromLatLong($latitude, $longitude);
$utm = Utm::fromLatLong($lat_long);

// Back to lat/long.
$lat_long = $utm->toLatLong();

// To a UTM grid reference string.
$grid_reference = $utm->toGridReference(); // '39L 198447 8893330'
$grid_reference = (string)$utm;
$grid_reference = $utm->toGridReference('%z$l%EE%NN'); // '39L0198447E8893330N'

The UTM grid reference formatting fields are:

The Mgrs class extends Utm with its set of reference conversion methods.

// Create from base UTM values.
$mgrs = new Mgrs($northing, $easting, $zone_number, $zone_letter);

// From lat/long (same as for Utm)
$mgrs = Mgrs::fromLatLong($latitude, $longitude);
$mgrs = Mgrs::fromLatLong($lat_long);

// From a MGRS grid reference.
// The accuracy of the reference is noted and stored with the reference.
$mgrs = Mgrs::fromGridReference($mgrs_grid_reference);

// To a MGRS grid reference string.
// Template is optional, defaulting to '%z%l%k%e%n'.
// The accuracy is optional 0 to 5, defaulting to 5.
$grid_reference = $mgrs->toGridReference($template, $accuracy);

// To a single lat/long coordinate in the *centre* of the square according to
// teh accuracy, to one metre.
// $accuracy is optional, and defaults to the accuracy of the current coordinate.
$lat_long = $mgrs->toPoint($accuracy);

// The bottom left coordinate, disregarding the accuracy (like toPoint with the
// maximum accuracy of 5).
$lat_long = $mgrs->toLatLong();

// To a Square region.
// The accuracy is optional 0 to 5, defaulting to 5.
$square = $mgrs->toSquare($accuracy);

The MGRS grid reference formatting fields are:

Instantiating a Utm, Mgrs, LatLong or Square class always requires a valid coordiate in some form.


Requires php Version >=5.3.0

The package academe/proj4php contains the following files

Loading the files please wait ....