systemico/conector_db

Singleton pattern to connect database Mysql, PostgreSQL, Oracle, SQL Server, and others.

1.0 2020-04-27 04:04 UTC

This package is auto-updated.

Last update: 2024-04-29 04:33:39 UTC


README

Singleton pattern to connect database Mysql, Postgrs, Oracle, SQL Server, and others.

Settings.php example

class Settings{
    public static $DB_HOST="";
    public static $DB_USER="";
    public static $DB_PASSWORD="";
    public static $DB_NAME="";
}

#Connect example

Example to run a new Database connection.

require_once dirname(__FILE__)."/../vendor/autoload.php";   
require_once dirname(__FILE__)."/Settings.php";    
use conector_db\ConectorDB;    
$conector= ConectorDB::get_conector(Settings::$DB_HOST,Settings::$DB_USER, Settings::$DB_PASSWORD, Settings::$DB_NAME);     
print_r($conector->select("show tables"));