ricci69/ultimatemysql

MySQL database access wrapper compatible with PHP 8.0

4.6 2024-01-23 19:46 UTC

This package is auto-updated.

Last update: 2024-04-28 15:16:36 UTC


README

MySQL database access wrapper compatible with PHP 8

Based on the excellent work of Jeff Williams https://www.phpclasses.org/package/3698-PHP-MySQL-database-access-wrapper.html

Why this repository

Despite it is being used by fortune 500 companies [source], the script isn't update since 16/08/2013 (almost 10 years!), so i thinked to create this repository with the aim of making it compatible with PHP 8, and being able to use it for another 10 years (i hope!).

How to get started

It's a very simple database access wrapper, well documented and safe against SQL injection hacks!

You can start with only 3 lines!

PHP Library

<?php
include("mysql.class.php");
$db = new MySQL(true, "testdb", "localhost", "root", "password");
$res = $db->QueryArray("SELECT * FROM Test");
?>

Composer package

...OR if you want to include it as a composer package, just type:

composer require ricci69/ultimatemysql

and after use the following PHP code

<?php
require 'vendor/autoload.php';
$db = new MySQL(true, "testdb", "localhost", "root", "password");
$res = $db->QueryArray("SELECT * FROM Test");
?>

Debug mode

The script looks for a file called .debugmysql (within the root directory or within the composer's vendor / module folder) and, if found, enters debug mode.

When debug mode is active, it writes all SQL queries executed inside the .debugmysql file.

How it work and examples

Check the "examples" directory to learn how it works, or read the very good documentation on https://ricci69.github.io/ultimatemysql

Contributions

Feel free to contribute to this project adding more feature or fixing issues, but before submitting a pull request, make sure your code passes all unit tests (refer to the /tests/coverage.md document)

Support this / me

If you liked this work, and you haven't wasted hours of work with this repository, you can think about supporting me with Ko-fi

ko-fi