Download the PHP package shaozeming/lumen-postgis without Composer
On this page you can find all versions of the php package shaozeming/lumen-postgis. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shaozeming/lumen-postgis
More information about shaozeming/lumen-postgis
Files in shaozeming/lumen-postgis
Package lumen-postgis
Short Description Postgis extensions for laravel+lumen. Aims to make it easy to work with geometries from laravel models
License MIT
Informations about the package lumen-postgis
Laravel postgis extension
Solemnly declare
- This is based on Phaza\Laravel-Postgis to modify Non-original;
修改位置
- 修改了readme.md 关于lumen5.4 安装的注册服务,需要注册两个服务(见下文)。
- 添加了几何数据迁移命令
$table->geometry('geom')
; - 添加 $location1->location = new GeomPoint(37.422009, -122.084047); 实现gis几何数据直接利用模型插入
Features
- Work with geometry classes instead of arrays. (
$myModel->myPoint = new Point(1,2)
) - Adds helpers in migrations. (
$table->polygon('myColumn')
)
Future plans
- Geometry functions on the geometry classes (contains(), equals(), distance(), etc… (HELP!))
Versions
- Use for Laravel
5.3.*
;5.4.*
- Use for lumen
5.3.*
;5.4.*
Installation
composer require shaozeming/lumen-postgis 'dev-master'
laravel Next add the DatabaseServiceProvider to your config/app.php
file.
That's all.
Lumen Next add the DatabaseServiceProvider to your bootstrap/app.php
file.
That's all.
Usage
First of all, make sure to enable postgis.
CREATE EXTENSION postgis;
To verify that postgis is enabled
SELECT postgis_full_version();
Migrations
Now create a model with a migration by running
php artisan make:model Location
If you don't want a model and just a migration run
php artisan make:migration create_locations_table
Open the created migrations with your editor.
Available blueprint geometries:
- point
- geometry
- multipoint
- linestring
- multilinestring
- polygon
- multipolygon
- geometrycollection
other methods:
- enablePostgis
- disablePostgis
Models
All models which are to be PostGis enabled must use the PostgisTrait.
You must also define an array called $postgisFields
which defines
what attributes/columns on your model are to be considered geometry objects.
Available geometry classes:
- Point
- Geometry
- MultiPoint
- LineString
- MultiLineString
- Polygon
- MultiPolygon
- GeometryCollection
All versions of lumen-postgis with dependencies
illuminate/database Version ^5.2
geo-io/wkb-parser Version ^1.0
jmikola/geojson Version ^1.0
bosnadev/database Version ~0.16