Recommend this page to a friend! |
Download |
Info | Example | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 163 | All time: 8,931 This week: 52 |
Version | License | PHP version | Categories | |||
core-php-wrapper-lib 1.0.0 | Custom (specified... | 5 | PHP 5, Databases |
<?php
|
Use the Database Library separately from CodeIgniter 3.
"require": {
"astute/CodeIgniterDB": "^1.0"
}
or with command line : composer require astute/CodeIgniterDB
You can also download it from Github, but no autoloader is provided so you'll need to register it with your own PSR-0 compatible autoloader.
<?php
use astute\CodeIgniterDB as CI;
$db_data = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'my_name',
'password' => 'my_password',
'database' => 'my_database',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
$oDb =& CI\DB($db_data);
For more information visit <a href="http://www.codeigniter.com/userguide3/database/index.html">CodeIgniter user guide</a>.
I've added the possibility to give a mysql ressource to reuse a already opened connection. Thus to not multiply connections and to use this in parallel with legacy code and proceed to a migration step by step. Works only with the mysql driver ! Method 1 (Direct call)
<?php
use astute\CodeIgniterDB as CI;
$db_data = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => 'my_name',
'database' => 'my_database',
'dbdriver' => 'mysql',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
$rDb = mysql_connect($db_data['hostname'], $db_data['root'], $db_data['password']);
$oDb =& CI\DB($db_data, null, $rDb);
Method 2 (Config file to call the object only) Config.php
<?php
include('src/DB.php');
use astute\CodeIgniterDB as CI;
$db_data = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'my_name',
'password' => 'my_password',
'database' => 'my_database',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
$db =& CI\DB($db_data);
index.php Calling the database object by config.php file
<?php
include('config.php');
$result1 = $db->get('table_name')->row();
$result2 = $db->select('columName')->get('table_name')->row();.
$result3 = $db->select('columName')->where('columName',1)->get('table_name')->row();
print_r($result1);
echo '<br>';
print_r($result2);
echo '<br>';
print_r($result3);
Files (98) |
File | Role | Description | ||
---|---|---|---|---|
src (8 files, 1 directory) | ||||
config.php | Conf. | Configuration script | ||
index.php | Example | Example script | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Read Me |
Files (98) | / | src |
File | Role | Description | ||
---|---|---|---|---|
drivers (1 file, 12 directories) | ||||
DB.php | Class | Class source | ||
DB_cache.php | Class | Class source | ||
DB_driver.php | Class | Class source | ||
DB_forge.php | Class | Class source | ||
DB_query_builder.php | Class | Class source | ||
DB_result.php | Class | Class source | ||
DB_utility.php | Class | Class source | ||
index.html | Doc. | Documentation |
Files (98) | / | src | / | drivers |
Files (98) | / | src | / | drivers | / | cubrid |
File | Role | Description |
---|---|---|
cubrid_driver.php | Class | Class source |
cubrid_forge.php | Class | Class source |
cubrid_result.php | Class | Class source |
cubrid_utility.php | Class | Class source |
index.html | Doc. | Documentation |
Files (98) | / | src | / | drivers | / | ibase |
File | Role | Description |
---|---|---|
ibase_driver.php | Class | Class source |
ibase_forge.php | Class | Class source |
ibase_result.php | Class | Class source |
ibase_utility.php | Class | Class source |
index.html | Doc. | Documentation |
Files (98) | / | src | / | drivers | / | mssql |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
mssql_driver.php | Class | Class source |
mssql_forge.php | Class | Class source |
mssql_result.php | Class | Class source |
mssql_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | mysql |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
mysql_driver.php | Class | Class source |
mysql_forge.php | Class | Class source |
mysql_result.php | Class | Class source |
mysql_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | mysqli |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
mysqli_driver.php | Class | Class source |
mysqli_forge.php | Class | Class source |
mysqli_result.php | Class | Class source |
mysqli_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | oci8 |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
oci8_driver.php | Class | Class source |
oci8_forge.php | Class | Class source |
oci8_result.php | Class | Class source |
oci8_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | odbc |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
odbc_driver.php | Class | Class source |
odbc_forge.php | Class | Class source |
odbc_result.php | Class | Class source |
odbc_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | pdo |
File | Role | Description | ||
---|---|---|---|---|
subdrivers (25 files) | ||||
index.html | Doc. | Documentation | ||
pdo_driver.php | Class | Class source | ||
pdo_forge.php | Class | Class source | ||
pdo_result.php | Class | Class source | ||
pdo_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | pdo | / | subdrivers |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
pdo_4d_driver.php | Class | Class source |
pdo_4d_forge.php | Class | Class source |
pdo_cubrid_driver.php | Class | Class source |
pdo_cubrid_forge.php | Class | Class source |
pdo_dblib_driver.php | Class | Class source |
pdo_dblib_forge.php | Class | Class source |
pdo_firebird_driver.php | Class | Class source |
pdo_firebird_forge.php | Class | Class source |
pdo_ibm_driver.php | Class | Class source |
pdo_ibm_forge.php | Class | Class source |
pdo_informix_driver.php | Class | Class source |
pdo_informix_forge.php | Class | Class source |
pdo_mysql_driver.php | Class | Class source |
pdo_mysql_forge.php | Class | Class source |
pdo_oci_driver.php | Class | Class source |
pdo_oci_forge.php | Class | Class source |
pdo_odbc_driver.php | Class | Class source |
pdo_odbc_forge.php | Class | Class source |
pdo_pgsql_driver.php | Class | Class source |
pdo_pgsql_forge.php | Class | Class source |
pdo_sqlite_driver.php | Class | Class source |
pdo_sqlite_forge.php | Class | Class source |
pdo_sqlsrv_driver.php | Class | Class source |
pdo_sqlsrv_forge.php | Class | Class source |
Files (98) | / | src | / | drivers | / | postgre |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
postgre_driver.php | Class | Class source |
postgre_forge.php | Class | Class source |
postgre_result.php | Class | Class source |
postgre_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | sqlite |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
sqlite_driver.php | Class | Class source |
sqlite_forge.php | Class | Class source |
sqlite_result.php | Class | Class source |
sqlite_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | sqlite3 |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
sqlite3_driver.php | Class | Class source |
sqlite3_forge.php | Class | Class source |
sqlite3_result.php | Class | Class source |
sqlite3_utility.php | Class | Class source |
Files (98) | / | src | / | drivers | / | sqlsrv |
File | Role | Description |
---|---|---|
index.html | Doc. | Documentation |
sqlsrv_driver.php | Class | Class source |
sqlsrv_forge.php | Class | Class source |
sqlsrv_result.php | Class | Class source |
sqlsrv_utility.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
core-php-wrapper-lib-2019-07-08.zip 227KB | |
core-php-wrapper-lib-2019-07-08.tar.gz | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Comments (4) | ||||||||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.