PHPackages                             phpexperts/postgres-for-laravel - 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. phpexperts/postgres-for-laravel

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

phpexperts/postgres-for-laravel
===============================

An ease-of-use library for using PostgreSQL with Laravel.

v1.1.0(2y ago)016MITPHPPHP &gt;=7.3

Since Dec 14Pushed 2y ago1 watchersCompare

[ Source](https://github.com/PHPExpertsInc/PostgresForLaravel)[ Packagist](https://packagist.org/packages/phpexperts/postgres-for-laravel)[ Docs](https://www.phpexperts.pro/)[ RSS](/packages/phpexperts-postgres-for-laravel/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (4)Used By (0)

Postgres For Laravel Library
============================

[](#postgres-for-laravel-library)

![TravisCI]()![Maintainability]()![Test Coverage]()

Postgres For Laravel is a PHP Experts, Inc., Project meant to ease the use of the PostgreSQL database in Laravel.

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

[](#installation)

Via Composer

```
composer require phpexperts/postgres-for-laravel
```

Usage
-----

[](#usage)

The library should be ready to be used immediately after including via composer.

### PostgreSQL Timestamps

[](#postgresql-timestamps)

Postgres' timestamp support is extremely suprior to MySQL's. Yet, Laravel only supports the dumbed-down timestamps by default. For best performance -including- both timezone-aware and millisecond resolution timestamps, it is best to let POstgres itself handle every table's timestamps. To do this, do the following:

```
  vendor   |       project        |         created_at         |         updated_at
------------+----------------------+----------------------------+----------------------------
phpexperts | simple-dto           | 2020-04-30 23:35:00        | 2023-07-18 19:08:47
phpexperts | rest-speaker         | 2023-07-30 09:35:53        | 2023-07-30 09:37:37
phpexperts | postgres-for-laravel | 2023-12-14 17:58:46.381623 | 2023-12-14 17:58:46.417537

```

**Automatic Autowiring**

1. Extend every model from PHPExperts\\PostgresForLaravel\\PostgresModel.
2. Run `./artisan migrate`

**Manual Wiring**

1. Add `public $timestamps = false;` to your Model.
2. Create a new migration: `./artisan make:migration use_native_postgres_timestamps`
3. Add the following code to the migration:

```
