ap-lib / mysql-instance
dev-main
2025-03-14 21:07 UTC
Requires
- php: ^8.3
- ap-lib/mysql: dev-main
- ap-lib/scheme: dev-main
- ap-lib/to-object: dev-main
This package is auto-updated.
Last update: 2025-03-14 21:09:25 UTC
README
A lightweight MySQL connection instancer with a simple and efficient API.
Installation
composer require ap-lib/mysql-instancer
Features
- Singleton-based MySQL connection management
- Easy configuration handling
- Automatic connection instantiation
- Scheme bases settings object, can be used for conf module
Requirements
- PHP 8.3 or higher
- MySQL database
Getting Started
Define a MySQL Instance
class DbName { use MysqlInstance; static protected function conf(): Mysql { return Core::conf()->db_name(); } }
Usage
$connection = DbName::get() ->select("users") ->fetchAll();
This retrieves a singleton instance of the Connect
object with the predefined configuration.
License
This project is licensed under the MIT License.