PHPackages                             ap-lib/mysql-instance - 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. ap-lib/mysql-instance

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

ap-lib/mysql-instance
=====================

014PHP

Since Mar 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ap-lib/mysql-instance)[ Packagist](https://packagist.org/packages/ap-lib/mysql-instance)[ RSS](/packages/ap-lib-mysql-instance/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AP\\Mysql\\Instancer
====================

[](#apmysqlinstancer)

[![MIT License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

A lightweight MySQL connection instancer with a simple and efficient API.

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

[](#installation)

```
composer require ap-lib/mysql-instancer
```

Features
--------

[](#features)

- Singleton-based MySQL connection management
- Easy configuration handling
- Automatic connection instantiation
- Scheme bases settings object, can be used for [conf module](https://github.com/ap-lib/conf)

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- MySQL database

Getting Started
---------------

[](#getting-started)

### Define a MySQL Instance

[](#define-a-mysql-instance)

```
class DbName
{
    use MysqlInstance;

    static protected function conf(): Mysql
    {
        return Core::conf()->db_name();
    }
}
```

### Usage

[](#usage)

```
$connection = DbName::get()
    ->select("users")
    ->fetchAll();
```

This retrieves a singleton instance of the `Connect` object with the predefined configuration.

License
-------

[](#license)

This project is licensed under the [MIT License](LICENSE).

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1215fe5ecc9ba0ab1c730d3c992125cf6ebf460562e66be71ebae127789d465a?d=identicon)[AntonPanfilov](/maintainers/AntonPanfilov)

---

Top Contributors

[![anton-panfilov](https://avatars.githubusercontent.com/u/1083546?v=4)](https://github.com/anton-panfilov "anton-panfilov (1 commits)")

### Embed Badge

![Health badge](/badges/ap-lib-mysql-instance/health.svg)

```
[![Health](https://phpackages.com/badges/ap-lib-mysql-instance/health.svg)](https://phpackages.com/packages/ap-lib-mysql-instance)
```

###  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.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

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

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/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)
