Download the PHP package lyhty/geometry without Composer

On this page you can find all versions of the php package lyhty/geometry. 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 geometry

Latest Version on Packagist PHP Laravel Total Downloads License

This package provides tools to parse and write various formats of Geometry data, with a possibility to extend it with custom adapters.

The package is greatly inspired by and many things are borrowed from the following packages: geoPHP by @phayes and laravel-mysql-spatial by @grimzy.

The package also provides a Model trait, that adds the OGC standard spatial functions to the Model and its Query builder.

Many of the package's functionalities relies on geos being installed on your system, along with php-geos PHP extension. The package however DOES NOT require this, but many of the features will be unavailable.

Installation

Install the package with Composer:

composer require lyhty/geometry

The package registers itself automatically.

Geometry Models

This package comes with classes for following geometry types:

All these classes extend an abstract class Lyhty\Geometry\Types\Geometry. Additionally, all classes except for type Point extend Lyhty\Geometry\Types\Collection class.

With these classes you can easily create your own geometry objects. For example:

Predicates

¹ Feature requires geos
² Feature utilizes geos if available

These models comes with various predicate methods:

Operations

¹ Feature requires geos
² Feature utilizes geos if available

Formatting

Other notable methods

Geometry Factory

The package also provides a powerful class that helps you parse, write and manipulate geometry data.

The class is accessible through a facade Lyhty\Geometry\Geom.

Parsing & Formatting

The parsing and formatting happens with the help of adapters.

Adapters

Out of the box the package supports parsing and writing with following standards and services:

Name Parse Syntax Format Syntax
WKT Geom::parse($data, 'wkt') Geom::format($geom, 'wkt')
EWKT Geom::parse($data, 'ewkt') Geom::format($geom, 'ewkt')
WKB Geom::parse($data, 'wkb', $isHex = false) Geom::format($geom, 'wkb', $asHex = false)
EWKB Geom::parse($data, 'ewkb', $isHex = false) Geom::format($geom, 'ewkb', $asHex = false)
GeoJSON Geom::parse($data, 'geo_json') Geom::format($geom, 'geo_json', $asArray = false)
KML Geom::parse($data, 'kml') Geom::format($geom, 'kml', $namespace = null)
GPX Geom::parse($data, 'gpx') Geom::format($geom, 'gpx', $namespace = null)
GeoRSS Geom::parse($data, 'geo_rss') Geom::format($geom, 'geo_rss', $namespace = null)
Google Geocode Geom::parse($address, 'google_geocode', $token = '') Geom::format($geom, 'google_geocode', $token = '')
GeoHash Geom::parse($data, 'geo_hash', $asGrid = false) Geom::format($geom, 'geo_hash', $precision = null)

Lyhty\Geometry\Eloquent\HasGeometryAttributes

Sometimes in our applications we need to have models with geometry columns set to them. This package provides a trait you can add to your Model, which turns the binary string of a geometry column into an interactive Lyhty\Geometry\Types\Geometry instance! All the methods previously listed are now usable with the Model!

You have to list the attributes that are geometry in the Model the following way:

The trait will override the Illuminate\Database\Eloquent\Builder and Illuminate\Database\Query\Builder instances within the Model utilizing the trait with the package's own respective Builder classes. This is required so the storing of geometry data to the database will work. Also several geometry query scopes are part of the base query builder.

Query scopes


All versions of geometry with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2 | ^8.2
illuminate/support Version ^8.0 | ^9.0 | ^10.0 | ^11.0
illuminate/database Version ^8.0 | ^9.0 | ^10.0 | ^11.0
geo-io/wkb-parser Version ^1.0
geo-io/wkb-generator Version ^1.0
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 lyhty/geometry contains the following files

Loading the files please wait ....