Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 664 Bytes

README.md

File metadata and controls

38 lines (27 loc) · 664 Bytes

PHP Postgis

A PHP Trait to convert Postgis coordinates to array and a PHP array to Postgis text.

Currently supports Point and Polygon types.

Usage

Use it as PHP trait.

<?php
use perspectivain\postgis\PostgisTrait;

class Customer extends ActiveRecord
{
    use PostgisTrait;
    ...
}

...

$coordinates = $model->WktToArray('Polygon', 'city_coordinates');

$model->city_coordinates = $model->arrayToWkt('Polygon', $coordinates);

Installing

The preferred way to install this extension is through Composer.

{
  "require": {
    "perspectivain/php-postgis": "*"
  }
}