eureka / component-database
PHP database library.
Installs: 1 189
Dependents: 5
Suggesters: 1
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: 7.4.*||8.0.*||8.1.*||8.2.*||8.3.*
- ext-pdo: *
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- phpstan/phpstan: ^1.10
- phpunit/phpcov: ^8.2
- phpunit/phpunit: ^9.6
- squizlabs/php_codesniffer: ^3.7
- symfony/cache: ^5.4||^6.3
This package is auto-updated.
Last update: 2024-12-06 18:28:29 UTC
README
PHP PDO abstraction with factory to handle reconnection & connections to multiple databases.
Installation
If you wish to install it in your project, require it via composer:
composer require eureka/component-database
You can install the component (for testing) with the following command:
make install
Update
You can update the component (for testing) with the following command:
make update
Usage
<?php use Eureka\Component\Database\ConnectionFactory; $factory = new ConnectionFactory( [ 'common' => [ 'dsn' => 'mysql:dbname=my_database;host=localhost;charset=UTF8', 'user' => 'user', 'password' => 'pass', 'options' => null, ], ] ); $connection = $factory->getConnection('common'); $connection->query('SELECT * FROM my_table');
Testing & CI (Continuous Integration)
You can run tests on your side with following commands:
make tests # run tests with coverage make testdox # run tests without coverage reports but with prettified output
You also can run code style check or code style fixes with following commands:
make phpcs # run checks on check style make phpcbf # run check style auto fix
To perform a static analyze of your code (with phpstan, lvl 9 at default), you can use the following command:
make phpstan
make analyze # Same as phpstan but with CLI output as table
To ensure you code still compatible with current supported version and futures versions of php, you need to run the following commands (both are required for full support):
make php74compatibility # run compatibility check on current minimal version of php we support make php81compatibility # run compatibility check on last version of php we will support in future
And the last "helper" commands, you can run before commit and push is:
make ci
This command clean the previous reports, install component if needed and run tests (with coverage report), check the code style and check the php compatibility check, as it would be done in our CI.
Contributing
See the CONTRIBUTING file.
License
This project is currently under The MIT License (MIT). See LICENCE file for more information.