PHPackages                             konstmal/postgresify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. konstmal/postgresify

ActiveLibrary[Database &amp; ORM](/categories/database)

konstmal/postgresify
====================

Extended PostgreSQL Functionality for Laravel

v1.0.2(8y ago)03.5kMITPHPPHP &gt;=5.5.9

Since May 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/konstmal/postgresify)[ Packagist](https://packagist.org/packages/konstmal/postgresify)[ RSS](/packages/konstmal-postgresify/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (5)Used By (0)

[![Postgresify](https://cloud.githubusercontent.com/assets/5347897/14873618/83c04980-0cc6-11e6-992b-fef3d866ac94.png)](https://cloud.githubusercontent.com/assets/5347897/14873618/83c04980-0cc6-11e6-992b-fef3d866ac94.png)

Note

> This package is under development.

Table of Contents
-----------------

[](#table-of-contents)

**[What is this?](#what-is-this)**

**[Installation](#installation)**

**[Geometric Types](#geometric-types)**

- [Box](#box)
- [Circle](#circle)
- [Line](#line)
- [Line Segment](#line-segment)
- [Path](#path)
- [Point](#point)
- [Polygon](#polygon)

**[Monetary Types](#monetary-types)**

- [Money](#money)

**[Network Address Types](#network-address-types)**

- [IP Address](#ip-address)
- [MAC Address](#mac-address)
- [Netmask](#netmask)

**[Range Types](#range-types)**

- [Date Range](#date-range)
- [Integer Range](#integer-range)
- [Numeric Range](#numeric-range)
- [Timestamp Range](#timestamp-range)
- [Timestamp Range w/ Timezone](#timestamp-timezone-range)

**[License](#license)**

**[References](#references)**

What is this?
-------------

[](#what-is-this)

Postgresify is a package for Laravel and Lumen that extends support to some of the more useful PostgreSQL data types. This package allows you to leverage PostgreSQL's data types, such as point, inet, circle, etc., within Laravel's Schema Builder and retrieve meaningful data from Fluent/Eloquent.

Example Migration:

```
Schema::create('hotel_search', function (Blueprint $table) {
    // ...

    $table->point('geocode_coordinates');
    $table->ipAddress('visitor_ip_address');
    $table->circle('search_area');
    $table->dateRange('reservation_period');
    $table->money('budget');

    // ...
});
```

Life's easier, right? The above use cases of PostgreSQL's types eliminate a few immediately noticeable headaches:

- Point types store geographic coordinates in one field--not two.
- IP address types will store IPv4 or IPv6--no `VARCHAR` here.
- Circle types store a center point and a radius &lt;(x, y), r&gt; in one field. There are 'hackier' ways to store radii related to a center point without this.
- Date range types store just that, date ranges. This, like the point type, eliminates the necessity of the second field.
- Money types store a signed, locale-sensitive currency amount, with a range of +/- 92 quadrillion! No more `DECIMAL(11,2)` or whatever people do these days.

Now let's discuss the actual utility afforded by these additional types. PostgreSQL is nicely equipped with functions and operators for meaningfully working with these data types. This depends on the architecture of your environment, but these types combined with the functions/operators allow you to offload some work onto your database server--which might be faster and could reduce some responsibilities within your application's code. Your mileage may vary. See this [StackExchange Q/A](http://programmers.stackexchange.com/questions/171024/never-do-in-code-what-you-can-get-the-sql-server-to-do-well-for-you-is-this).

Installation
------------

[](#installation)

To install this package you will need:

- Laravel 5.1+ or Lumen 5.1+
- PHP 5.5.9+

This package is intended for **PostgreSQL 9.4+**.

Add this package to your `composer.json` file as a dependency: `composer require aejnsn/postgresify dev-master`

### Laravel

[](#laravel)

After installing via Composer, register Postgresify's `DatabaseServiceProvider` in your `config/app.php`configuration file like so:

```
'providers' => [
    // Other service providers...

    Aejnsn\Postgresify\DatabaseServiceProvider::class,
],
```

### Basic Usage

[](#basic-usage)

If you would like code completion in your IDE for the PostgreSQL types made available via Postgresify, be sure your migrations (or other uses of Illuminate's Schema Builder) `use` the `Aejnsn\Postgresify\Database\Schema\Blueprint` class as in this example:

```
