Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 121 | All time: 9,494 This week: 129![]() |
Version | License | PHP version | Categories | |||
dbal-wrapper 1.0.0 | BSD License | 5.4 | Databases |
Description | Author | |
This class can establish database connections with Doctrine DBAL. |
|
Light Wrapper around Docrines DBAL to handle management of configuration settings for various database types
require "cymapgt/db": "1.*"
The DB package is built for building database connection settings for various database types supported by Doctrine DBAL
DB::setDbType('mysql');
Replace mysql with either of the following: oracle, mssql, sqlite, sybase, drizzle, postgres
DB::getDbType();
DB::getDatabaseParameters();
Return an array of the database parameters stored in the web server / operating system environment. The array is an associative array whose indices vary depending on the database type. Database configuration array keys match the Doctrine DBAL database connection settings listed on the documentation for DBAL (http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html).
An example for MySQL is the array would contain user, password, host, port, dbname, driver, unix_socket and charset indices.
DB::validateDbParameters($dbParams);
Accepts an array of the DB parameters. It then does two checks. It ensures that the driver which DBAL will use for the database is actually loaded. It then checks that any of the default settings any of the various databases DBAL can load are present in the array. If any of the two checks fails a cymapgt\Exception\DBException will be thrown.
DB::sanitizeDbParameters($dbParams);
Accepts an array of the DB parameters. Some of the DB connection settings are optional e.g. the charset in mysql. This method discards empty configurations prior to the DB connection being instantiated.
//dbObj is an instance of DBAL loading your favourite DB . You can make your queries
$dbObj = DB::connectDb();
DB::setDbType('mysql');
//define settings in array
$mysqlSettings = array (
'user' => 'cr7',
'password' => 'valdebas',
'host' => 'localhost',
'port' => '3306',
'dbname' => 'undecima'
);
//return dbal instance with the mysql dbl loaded
$dbObj = DB::connectDbNew($mysqlSettings);
//Part of resource management and ensuring sensitive information is discarded is destroying resources after use
DB::closeDbConnection();
DB Tests are provided with the package. SQLITE db is used in the testsuite.
BSD 3 CLAUSE
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Auxiliary data |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.