PHPackages                             alxmsl/connection - 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. [Caching](/categories/caching)
4. /
5. alxmsl/connection

ActiveLibrary[Caching](/categories/caching)

alxmsl/connection
=================

Simple library for support storage connections

v2.0.0(10y ago)22815[1 issues](https://github.com/alxmsl/Connection/issues)1Apache-2.0PHP

Since Jul 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/alxmsl/Connection)[ Packagist](https://packagist.org/packages/alxmsl/connection)[ RSS](/packages/alxmsl-connection/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (2)Versions (20)Used By (1)

Connection
==========

[](#connection)

[![License](https://camo.githubusercontent.com/a838cc0d5a489fa2b42f9a4caad88dfde31463481a9af473eaeb4983dfc0629c/68747470733a2f2f706f7365722e707567782e6f72672f616c786d736c2f636f6e6e656374696f6e2f6c6963656e7365)](https://packagist.org/packages/alxmsl/connection)[![Latest Stable Version](https://camo.githubusercontent.com/ce1b76565bf5f3d1df4d9cf20fc9a2b1ee6dc41e9a8563ac6e7d171b33aa8ba8/68747470733a2f2f706f7365722e707567782e6f72672f616c786d736c2f636f6e6e656374696f6e2f76657273696f6e)](https://packagist.org/packages/alxmsl/connection)[![Total Downloads](https://camo.githubusercontent.com/7d2ac5950cc566f06d32e3aff4cc427a51088c0a61a4fca731ddc404c1ee5aac/68747470733a2f2f706f7365722e707567782e6f72672f616c786d736c2f636f6e6e656374696f6e2f646f776e6c6f616473)](https://packagist.org/packages/alxmsl/connection)

Simple set of classes for support some connections. At this moment library supports:

- redis connection over [phpredis](https://github.com/nicolasff/phpredis)
- redis connection over [predis](https://github.com/nrk/predis)
- [postgresql](http://php.net/manual/en/intro.pgsql.php) connection

Predis usage example
--------------------

[](#predis-usage-example)

```
use alxmsl\Connection\Predis\PredisFactory;

// Create Redis Client instance with you configuration settings
$Redis = PredisFactory::createPredisByConfig(array(
    'host' => 'localhost',
    'port' => 6379,
));

// Use Redis commands
$Redis->set('test', '7');
var_dump($Redis->get('test'));

```

Redis usage example (phpredis)
------------------------------

[](#redis-usage-example-phpredis)

```
use alxmsl\Connection\Redis\RedisFactory;

// Create Redis Client instance with you configuration settings
$Redis = RedisFactory::createRedisByConfig(array(
    'host' => 'localhost',
    'port' => 6379,
));

// Use Redis commands
$Redis->set('test', '7');
var_dump($Redis->get('test'));

```

Postgres usage example
----------------------

[](#postgres-usage-example)

```
use alxmsl\Connection\Postgresql\Connection;

// Create connection
$Connection = new Connection();
$Connection->setUserName('postgres')
    ->setPassword('postgres')
    ->setDatabase('postgres')
    ->setHost('localhost')
    ->setPort(5432);

// Connect and ...
$Connection->connect();

// ..query needed data
$Result = $Connection->query('select * from "pg_class"', null);
$Data = $Result->getResult();
var_dump($Data[0]);

// ..query data with parameters
$Result = $Connection->query('select count(*) from {{ tbl(table) }}', array(
    'table' => 'pg_class',
));
$Data = $Result->getResult();
var_dump($Data);

```

Contributing
------------

[](#contributing)

I welcome any help in developing this project. I accept contributions as pull requests. Finally, I kindly ask that you add your tests and document all changes in library behavior/corrections. You are welcome to add copyright notices with your name/nickname and email in all files, that you change

License
-------

[](#license)

Copyright 2015-2016 Alexey Maslov

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

```
http://www.apache.org/licenses/LICENSE-2.0

```

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~25 days

Total

16

Last Release

3752d ago

Major Versions

v1.2.2 → v2.0.02016-02-07

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/950057?v=4)[Alexey Maslov](/maintainers/alxmsl)[@alxmsl](https://github.com/alxmsl)

---

Top Contributors

[![alxmsl](https://avatars.githubusercontent.com/u/950057?v=4)](https://github.com/alxmsl "alxmsl (55 commits)")[![chapsuk](https://avatars.githubusercontent.com/u/5525114?v=4)](https://github.com/chapsuk "chapsuk (7 commits)")[![dec5e](https://avatars.githubusercontent.com/u/140601?v=4)](https://github.com/dec5e "dec5e (2 commits)")[![realmfoo](https://avatars.githubusercontent.com/u/719682?v=4)](https://github.com/realmfoo "realmfoo (1 commits)")[![un0topface](https://avatars.githubusercontent.com/u/15339910?v=4)](https://github.com/un0topface "un0topface (1 commits)")

---

Tags

postgresqlpostgresredispredisphpredis

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alxmsl-connection/health.svg)

```
[![Health](https://phpackages.com/badges/alxmsl-connection/health.svg)](https://phpackages.com/packages/alxmsl-connection)
```

###  Alternatives

[predis/predis-async

Asynchronous version of Predis

366348.4k](/packages/predis-predis-async)[predis/service-provider

Predis service provider for the Silex microframework

68546.6k1](/packages/predis-service-provider)[jamescauwelier/psredis

Sentinel client for the popular php redis client

77392.9k5](/packages/jamescauwelier-psredis)[cache/predis-adapter

A PSR-6 cache implementation using Redis (Predis). This implementation supports tags

272.6M13](/packages/cache-predis-adapter)[contributte/redis

Redis client integration into Nette framework

181.6M2](/packages/contributte-redis)[maykonn/codeigniter-predis

The CodeIgniter Redis package

129.3k](/packages/maykonn-codeigniter-predis)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
