Download the PHP package sad_spirit/pg_wrapper without Composer

On this page you can find all versions of the php package sad_spirit/pg_wrapper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pg_wrapper

sad_spirit\pg_wrapper

Note: master branch is being upgraded for PHP 8.2+

Branch 2.x contains the stable version compatible with PHP 7.2+

Build Status

Static Analysis

This package has two parts and purposes

While the converter part can be used separately e.g. with PDO, features like transparent conversion of query results work only with the wrapper.

Installation

Require the package with composer:

pg_wrapper requires at least PHP 8.2. Native pgsql extension should be enabled to use classes that access the DB (the extension is not a hard requirement).

Minimum supported PostgreSQL version is 9.3

It is highly recommended to use PSR-6 compatible metadata cache in production to prevent possible metadata lookups from database on each page request.

Why type conversion?

PostgreSQL supports a large (and extensible) set of complex database types: arrays, ranges, geometric and date/time types, composite (row) types, JSON...

Unfortunately neither of PHP extensions for talking to PostgreSQL (pgsql and PDO_pgsql) can map these complex types to their PHP equivalents. They return string representations instead:

yields

And that is where this library kicks in:

yields

Why another OO wrapper when we have PDO, Doctrine DBAL, etc?

The goal of an abstraction layer is to target the Lowest Common Denominator and thus it intentionally hides some low-level APIs that we can use with the native extension and / or adds another level of complexity.

Another example: a very common problem for database abstraction is providing a list of parameters to a query with an IN clause

where ? actually represents a variable number of parameters.

On the one hand, if you don't need the abstraction, then Postgres has native array types, and this can be easily achieved with the following query

passing an array literal as its parameter value

On the other hand, Doctrine DBAL has its own solution for parameter lists which once again depends on rewriting SQL and does not work with prepare() / execute(). It also has "support" for array types, but that just (un)serializes PHP arrays rather than converts them from/to native DB representation, which will obviously not work with the above query.

Documentation

Is in the wiki

Type conversion:

Working with PostgreSQL:


All versions of pg_wrapper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-ctype Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sad_spirit/pg_wrapper contains the following files

Loading the files please wait ....