Download the PHP package mjaschen/phpgeo without Composer

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

FAQ

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.

Example:
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?

Informations about the package phpgeo

phpgeo - A Simple Geo Library for PHP

phpgeo provides abstractions to geographical coordinates (including support for different ellipsoids) and allows you to calculate geographical distances between coordinates with high precision.

phpgeo Tests Documentation Status Scrutinizer Code Quality

Requirements

Minimum required PHP version is 8.1. phpgeo is tested up to PHP 8.3.

New features will only go into the main branch and won't be backported.

It's possible to install older versions of phpgeo for older PHP versions. Please refer to the following table for the compatibility matrix:

PHP Version phpgeo Version Support Status Composer Install
8.3 5.x ✅ active composer require mjaschen/phpgeo
8.2 5.x ✅ active composer require mjaschen/phpgeo
8.1 5.x ✅ active composer require mjaschen/phpgeo
8.0 4.x ⚠️ security only composer require mjaschen/phpgeo:^4.0
7.4 4.x ⚠️ security only composer require mjaschen/phpgeo:^4.0
7.3 4.x ⚠️ security only composer require mjaschen/phpgeo:^4.0
7.2 3.x ❌ end of life composer require mjaschen/phpgeo:^3.0
7.1 2.x ❌ end of life composer require mjaschen/phpgeo:^2.0
7.0 2.x ❌ end of life composer require mjaschen/phpgeo:^2.0
5.6 1.x ❌ end of life composer require mjaschen/phpgeo:^1.0
5.5 1.x ❌ end of life composer require mjaschen/phpgeo:^1.0
5.4 1.x ❌ end of life composer require mjaschen/phpgeo:^1.0

Documentation

The documentation is available at phpgeo.marcusjaschen.de.

Installation

Using Composer, just add it to your composer.json by running:

Upgrading

Update the version constraint in the project's composer.json and run composer update or require the new version by running:

Upgrading to 5.x

phpgeo has some breaking changes in the 5.x release line. Please refer to the following list to see what has changed and what you need to do to upgrade your code.

Change Description Action
setPoint1() and setPoint2() methods removed from Line The Line class now is immutable. Use the constructor to create a new instance of Line.
removed support for PHP 7.3, 7.4 and 8.0 Older PHP versions are no longer supported. Upgrade to at least PHP 8.1.

License

Starting with version 2.0.0 phpgeo is licensed under the MIT license. Older versions were GPL-licensed.

Features

Info: Please visit the documentation site for complete and up-to-date documentation with many examples!

phpgeo provides the following features (follow the links for examples):

Examples/Usage

This list is incomplete, please visit the documentation site for the full monty of documentation and examples!

Distance between two coordinates (Vincenty's Formula)

Use the calculator object directly:

or call the getDistance() method of a Coordinate object by injecting a calculator object:

Simplifying a polyline

Polylines can be simplified to save storage space or bandwidth. Simplification is done with the Ramer–Douglas–Peucker algorithm (AKA Douglas-Peucker algorithm).

Polygon contains a point (e.g. "GPS geofence")

phpgeo has a polygon implementation which can be used to determinate if a point is contained in it or not. A polygon consists of at least three points. Points are instances of the Coordinate class.

Warning: The calculation gives wrong results if the polygons has points on both sides of the 180/-180 degrees meridian.

Formatted output of coordinates

You can format a coordinate in different styles.

Decimal Degrees

Degrees/Minutes/Seconds (DMS)

GeoJSON

Development

Run Tests

Before submitting a pull request, please be sure to run all checks and tests and ensure everything is green.

To run all checks and tests at once, just use composer ci.

Of course, it's possible to use the test runners directly, e.g. for PHPUnit:

Psalm:

Running GitHub Actions locally

It's possible to run the whole CI test matrix locally with act:

Credits


All versions of phpgeo with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mjaschen/phpgeo contains the following files

Loading the files please wait ....