Skip to content

nicksonjean/PHP-Generic-Database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-Generic-Database

PHP - >=8.1 License

PHP-Generic-Database is a set of PHP classes for connecting, displaying and generically manipulating data from a database, making it possible to centralize or standardize all the most varied types and behaviors of each database in a single format, using the standard Strategy, heavily inspired by Medoo and Dibi.

Supported Databases

PHP-Generic-Database currently supports the following mechanisms/database:

MariaDB MySQL Postgres MSSQL Oracle Firebird Interbase SQLite

Features

  • Lightweight - Light, simple and minimalist, easy to use and with a low learning curve.
  • Agnostic - It can be used in different ways, supporting chainable methods, fluent design, dynamic arguments and static array.
  • Easy - Easy to learn and use, with a friendly construction.
  • Powerful - Supports various common and complex SQL queries, data mapping and prevents SQL injection.
  • Compatible - Supports MySQL/MariaDB, SQLSrv/MSSQL, Interbase/Firebird, PgSQL, OCI, SQLite, and more.
  • Auto Escape - Automatically escape SQL queries according to the driver dialect or SQL engine used.
  • Friendly - Works well with every PHP framework, such as Laravel, Codeigniter, CakePHP, and frameworks that support singleton extension or composer.
  • Free - Under the MIT license, you can use it anywhere, for whatever purpose.

Requirements

  • PHP >= 8.1
  • Composer
  • Native Extensions
    • MySQL/MariaDB (MySQLi) [php_mysqli.dll/so]
    • PostgreSQL (PgSQL) [php_pgsql.dll/so]
    • Oracle (OCI8) [php_oci8_*.dll/so]
    • SQL Server (sqlsrv) [php_sqlsrv.dll/so]
    • Firebird/Interbase (ibase: gds | firebird: fds) [php_interbase.dll/so]
    • SQLite (SQLite3) [php_sqlite3.dll/so]
  • PDO Extensions
    • MySQL/MariaDB (MySQL) [php_pdo_mysql.dll/so]
    • PostgreSQL (PgSQL) [php_pdo_pgsql.dll/so]
    • Oracle (OCI) [php_pdo_oci.dll/so]
    • SQL Server (sqlsrv) [php_pdo_sqlsrv.dll/so]
    • Firebird/Interbase (ibase: gds | firebird: fds) [php_pdo_firebird.dll/so]
    • SQLite (SQLite) [php_pdo_sqlite.dll/so]
    • ODBC (ODBC) [php_pdo_obdc.dll/so]
  • ODBC Externsions
    • MySQL/MariaDB (MySQL) [myodbc8a.dll/so]
    • PostgreSQL (PgSQL) [psqlodbc30a.dll/so]
    • OCI (ORACLE) [sqora32.dll/so]
    • SQL Server (sqlsrv) [sqlsrv32.dll/so]
    • Firebird/Interbase (ibase: gds | firebird: fds) [odbcFb.dll/so]
    • SQLite (SQLite) [sqlite3odbc.dll/so]
    • Access (Access) [aceodbc.dll/so]
    • Excel (Excel) [aceodexl.dll/so]
    • Text (Text) [aceodtxt.dll/so]
  • Optional External Formats
    • INI (php native compilation)
    • XML (ext-libxml, ext-xmlreader, ext-simplexml)
    • JSON (php native compilation)
    • YAML (ext-yaml)

PHP Settings

  • DLLs Compiled from each database engine for each PHP version.
  • PHP.ini configuration and extension instalation.

Extension Instalation

  1. Edit the php.ini file and remove the ';' for the database extension you want to install.
  2. The .dll is for Windows and the .so is for Linux/UNIX.
  3. Uncomment the lines of the extensions you want to enable.
  • From
;extension=php_pdo_mysql.dll
;extension=php_pdo_mysql.so
  • To
extension=php_pdo_mysql.dll
extension=php_pdo_mysql.so
  1. Save it, and restart the PHP or Apache Server.
  2. If the extension is installed successfully, you can find it on phpinfo() output.

Manual Installation

  1. Make sure Composer is installed, otherwise install from the official website.
  2. Make sure Git is installed, otherwise install from the official website.
  3. After Composer and Git are installed, clone this repository with the command line below:
git clone https://github.com/nicksonjean/PHP-Generic-Database.git
  1. Then run the following command to install all packages and dependencies for this project:
composer install
  1. [Optional] If you need to reinstall, run the following command:
composer setup

Installation via Docker

  1. Make sure Docker Desktop is installed, otherwise install from the official website.
  2. Create an account to use Docker Desktop/Hub, and be able to clone containers hosted on the Docker network.
  3. Once logged in to Docker Hub and with Docker Desktop open on your system, run the command below:
docker pull php-generic-database:8.1-full
  1. Docker will download, install and configure a Debian-Like Linux Custom Image as Apache and with PHP 8.1 with all Extensions properly configured.

Installation via Composer

  1. Make sure Composer is installed, otherwise install from the official website.
  2. After Composer are installed, clone this repository with the command line below:
  3. Add PHP-Generic-Database to the composer.json configuration file.
composer require nicksonjean/php-generic-database
  1. And update the composer
composer update

Documentation

How to use

Below is a series of readmes containing examples of how to use the lib and a topology image of the native drivers and pdo.

License

PHP-Generic-Database is released under the MIT license.

ToDo

  • Infrastructure
    • Creation of the Container in Docker.
    • Creation of Migrations between all Databases.
  • Source
    • Connection
      • Possibility of use with Fluent Design and Chained Methods.
      • Improved use of the Static Calling format, now using array by key and value for arguments.
      • Improved use of the Static Calling format, now using named arguments.
      • Adjust in Attribute DEFAULT_FETCH_MODE
      • Add file support format connection to XML.
      • Add file support format connection to JSON.
      • Add file support format connection to INI.
      • Add file support format connection to YAML.
      • Add file support format connection to NEON.
      • Added compatibility for PDO engine.
      • Added compatibility for ODBC engine.
      • Added compatibility for MongoDB Database.
      • Added compatibility for Cassandra Database.
      • Added compatibility for SyBase Database.
      • Added compatibility for dBase Database.
    • Implement fetch and fetchAll methods.
    • Add transaction, commit and rollback support.
    • QueryBuilder creation for engines.
    • QueryBuilder creation for strategy.
    • Identify engine version for detect support Pagination Syntax (SQL Server 2008 unsupported pagination nativally).
    • Integrate version and compile options in attach in attributes connections.
    • Increase new extra connection attribute for ODBC, sets database alias manually.
    • Remove connection attribute exception and validate exceptions manually.
    • Add boolean feature for cache connections settings.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published