PHPackages                             laykith/easyconnect - 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. laykith/easyconnect

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

laykith/easyconnect
===================

A simple PDO manager to manage connections and reduce code in non-framework PHP scripts.

1.1.0(7y ago)4211MITPHPPHP &gt;=5.3.0

Since Oct 26Pushed 7y agoCompare

[ Source](https://github.com/laykith/EasyConnect)[ Packagist](https://packagist.org/packages/laykith/easyconnect)[ RSS](/packages/laykith-easyconnect/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

EasyConnect
===========

[](#easyconnect)

A simple PDO manager to manage connections and reduce code in non-framework PHP scripts.

Tested:

- SQLite
- MySQL
- PostgreSQL

Setup:
------

[](#setup)

1. Install [Composer](https://getcomposer.org/) and run `composer require laykith/easyconnect` in your project.
2. Start using EasyConnect

### Recommended

[](#recommended)

1. Add [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv) with `composer require vlucas/phpdotenv`
2. Add your .env file to .gitignore

Usage:
------

[](#usage)

Load class

```
require __DIR__ . '/vendor/autoload.php';

use EasyConnect\EasyConnect;

//Example configs (Use what you need based on driver)
$config = [
    'driver'   => 'Sqlite',                              //MySQL SQLite pgsql - (Case Insensetive)
    'filepath' => 'absolute/path/to/database/file.db',   //required for: SQLite
    'host'     => 'localhost',                           //required for: MySQL & pgsql
    'port'     => '3306',                                //required for: MySQL & pgsql
    'dbname'   => 'name',                                //required for: MySQL & pgsql
    'username' => 'root',                                //required for: MySQL & pgsql
    'password' => 'password123',                         //required for: MySQL & pgsql
];

//Suggestion: Use vlucas/phpdotenv package to load values
$config = [
    'driver'   => getEnv('database_driver'),     //MySQL SQLite pgsql - (Case Insensetive)
    'filepath' => getEnv('database_filepath'),   //required for: SQLite
    'host'     => getEnv('database_host'),       //required for: MySQL & pgsql
    'port'     => getEnv('database_port'),       //required for: MySQL & pgsql
    'dbname'   => getEnv('database_name'),       //required for: MySQL & pgsql
    'dbname'   => getEnv('database_name'),       //required for: MySQL & pgsql
    'password' => getEnv('password'),            //required for: MySQL & pgsql
];

$database = new EasyConnect($config);
```

Retrive data from database

```
//Example query
$query = 'SELECT * FROM user';

//Params (Optional but highly advised to protect from SQL injections)
$params = [];

//Returns array of results
$result = $database->getData($query, $params);
```

Inserting / Updating / Deleting data

```
//Insert data
//Query (Required)
$query = 'INSERT INTO user (username, password) VALUES (:username, :password)';

//Params (Optional but highly advised to protect from SQL injections)
$params = [
    ':username' => $_POST['username'],
    ':password' => password_hash($_POST['password'], PASSWORD_BCRYPT),
];

//Insert into Database
$database->setData($query,$params);
```

Retrive PDO exceptions

```
//Gets the error message if PDO exception was triggered.
$database->getError();
```

License
-------

[](#license)

[MIT](LICENSE) © [André Broman](https://github.com/laykith/)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~23 days

Total

2

Last Release

2733d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/79fff40dbf1c25e8e8f62333372e2b9c464eef85c322a6702544f72b33335355?d=identicon)[laykith](/maintainers/laykith)

---

Top Contributors

[![brooman](https://avatars.githubusercontent.com/u/31318105?v=4)](https://github.com/brooman "brooman (10 commits)")

---

Tags

databasemysqlphppostgresqlsqlite3

### Embed Badge

![Health badge](/badges/laykith-easyconnect/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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