2017 © Pedro Pelรกez
 

library postgresql-for-doctrine

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

image

martin-georgiev/postgresql-for-doctrine

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

  • Tuesday, July 31, 2018
  • by martin-georgiev
  • Repository
  • 8 Watchers
  • 34 Stars
  • 37,376 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 3 Open issues
  • 21 Versions
  • 26 % Grown

The README.md

Scrutinizer Code Quality Coverage Status Latest Stable Version Total Downloads, (*1)

PostgreSQL for Doctrine

Enhances Doctrine with PostgreSQL-specific features and functions. Supports PostgreSQL 9.4+ and PHP 8.1+., (*2)

Quick Start

// Register types with Doctrine
Type::addType('jsonb', "MartinGeorgiev\\Doctrine\\DBAL\\Types\\Jsonb");
Type::addType('text[]', "MartinGeorgiev\\Doctrine\\DBAL\\Types\\TextArray");
Type::addType('numrange', "MartinGeorgiev\\Doctrine\\DBAL\\Types\\NumRange");

// Use in your Doctrine entities
#[ORM\Column(type: 'jsonb')]
private array $data;

#[ORM\Column(type: 'text[]')]
private array $tags;

#[ORM\Column(type: 'numrange')]
private NumericRange $priceRange;

// Use in DQL
$query = $em->createQuery('
    SELECT e
    FROM App\Entity\Post e
    WHERE CONTAINS(e.tags, ARRAY[:tags]) = TRUE
    AND JSON_GET_FIELD(e.data, :field) = :value
');

๐Ÿš€ Features Highlight

This package provides comprehensive Doctrine support for PostgreSQL features:, (*3)

Data Types

  • Array Types
    • Integer arrays (int[], smallint[], bigint[])
    • Float arrays (real[], double precision[])
    • Text arrays (text[])
    • Boolean arrays (bool[])
    • JSONB arrays (jsonb[])
  • JSON Types
    • Native JSONB support
    • JSON field operations
    • JSON construction and manipulation
  • Network Types
    • IP addresses (inet, inet[])
    • Network CIDR notation (cidr, cidr[])
    • MAC addresses (macaddr, macaddr[])
  • Geometric Types
    • Point (point, point[])
  • Range Types
    • Date and time ranges (daterange, tsrange, tstzrange)
    • Numeric ranges (numrange, int4range, int8range)

PostgreSQL Operators

  • Array Operations
    • Contains (@>)
    • Is contained by (<@)
    • Overlaps (&&)
    • Array aggregation with ordering
  • JSON Operations
    • Field access (->, ->>)
    • Path operations (#>, #>>)
    • JSON containment and existence operators
  • Range Operations
    • Containment checks (in PHP value objects and for DQL queries with @> and <@)
    • Overlaps (&&)

Functions

  • Text Search
    • Full text search (to_tsvector, to_tsquery)
    • Pattern matching (ILIKE, SIMILAR TO)
    • Regular expressions
  • Array Functions
    • Array aggregation (array_agg)
    • Array manipulation (array_append, array_prepend, array_remove, array_replace, array_shuffle)
    • Array dimensions and length
  • JSON Functions
    • JSON construction (json_build_object, jsonb_build_object)
    • JSON manipulation and transformation
  • Date Functions
  • Aggregate Functions
    • Aggregation with ordering and distinct (array_agg, json_agg, jsonb_agg)
    • Special aggregates (any_value, xmlagg)
  • Mathematical/Arithmetic Functions
  • Range Functions
  • Data Type Formatting Functions

Full documentation: - Available Types - Value Objects for Range Types - Available Functions and Operators - Common Use Cases and Examples, (*4)

๐Ÿ“ฆ Installation

composer require martin-georgiev/postgresql-for-doctrine

๐Ÿ”ง Integration Guides

๐Ÿ’ก Usage Examples

See our Common Use Cases and Examples for detailed code samples., (*5)

๐Ÿงช Testing

Unit Tests

composer run-unit-tests

PostgreSQL Integration Tests

We also provide integration tests that run against a real PostgreSQL database to ensure compatibility:, (*6)

# Start PostgreSQL using Docker Compose
docker-compose up -d

# Run integration tests
composer run-integration-tests

# Stop PostgreSQL
docker-compose down -v

See tests-integration/README.md for more details., (*7)

โญ Support the Project

๐Ÿ’– GitHub Sponsors

If you find this package useful for your projects, please consider sponsoring the development via GitHub Sponsors. Your support helps maintain this package, create new features, and improve documentation., (*8)

Benefits of sponsoring: - Priority support for issues and feature requests - Direct access to the maintainer - Help sustain open-source development, (*9)

Other Ways to Help

๐Ÿ“ License

This package is licensed under the MIT License. See the LICENSE file for details., (*10)

The Versions

31/07 2018

dev-ci-pipeline-changes

dev-ci-pipeline-changes

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

postgresql postgres doctrine dbal jsonb martin georgiev array data types

31/07 2018

dev-composer-and-ci-pipeline-updates

dev-composer-and-ci-pipeline-updates

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

postgresql postgres doctrine dbal jsonb martin georgiev array data types

31/07 2018

dev-develop

dev-develop

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

postgresql postgres dbal doctrine2 jsonb martin georgiev array data types

30/07 2018

dev-static-analysis

dev-static-analysis

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

postgresql postgres dbal doctrine2 jsonb martin georgiev array data types

29/07 2018

dev-boyscout/ci-enforce-code-style

dev-boyscout/ci-enforce-code-style

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

postgresql postgres dbal doctrine2 jsonb martin georgiev array data types

01/04 2018

dev-feature/php-7

dev-feature/php-7

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

postgresql postgres dbal doctrine2 jsonb martin georgiev array data types

17/03 2018

dev-master

9999999-dev

PostgreSQL enhancements for Doctrine. Provides support for JSONB and array data types and operators and other specific functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

postgresql postgres dbal doctrine2 jsonb martin georgiev array data types

21/03 2017

0.10

0.10.0.0

PostgreSQL enhancements for Doctrine2. Provides support for JSONB and array data types and operators and other specific functions.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

postgresql postgres dbal doctrine2 jsonb martin georgiev array data types

02/03 2017

0.9

0.9.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

22/02 2016

0.8.1

0.8.1.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

20/01 2016

0.8

0.8.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

The Development Requires

by Martin Georgiev

14/12 2015

0.7

0.7.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

11/11 2015

0.6.2

0.6.2.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

10/11 2015

0.6.1

0.6.1.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

09/11 2015

0.6

0.6.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

21/10 2015

0.5

0.5.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

19/10 2015

0.4

0.4.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

14/10 2015

0.3

0.3.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

17/08 2015

0.2

0.2.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

17/08 2015

0.1.1

0.1.1.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev

12/07 2015

0.1

0.1.0.0

Extends Doctrine2 DBAL & DQL with Postgres 9.4+ data types, operators and commands

  Sources   Download

MIT

The Requires

 

by Martin Georgiev