dev-master
9999999-dev http://github.com/pedra/DataData componentes (configuration, databases, etc)
MIT
The Requires
- php >=5.4.0
by Bill Rocha
database config data
Data componentes (configuration, databases, etc)
Config for Start PHP, (*1)
[2014/01/30] add data base access point by PDO., (*2)
Composer install:, (*3)
Add this in your composer.json:, (*4)
"require": { "neos/data": "dev-master" }
Now, type in terminal:, (*5)
$ composer update
Optional condition to make things easier!, (*6)
Type it in your index.php or bootstrap file:, (*7)
class_alias('Neos\Data\Config', 'o'); class_alias('Neos\Data\Conn', 'DB');
Or, in class with namespaces, type (in top):, (*8)
use Neos\Data\Config as o; use Neos\Data\Conn as DB;
Configurations, (*9)
//loading config file o::load('path/to/config.ini');
get and set config itens, (*10)
//simple get node print_r(o::item()); //get item print_r(o::get('item')); //set new value o::set('item', [mixed] value);
saving the configuration file, (*11)
o::save(); //or o::save('path/to/copy/config.ini');
Data Base, (*12)
$value = 01; $db = (new DB())->query('SELECT * FROM Table WHERE FielN = :value', ['value'=>$value]); //Dump print_r($db->getLine(0));
Setting Alias for a connection database, (*13)
in Config.ini, (*14)
[db] default = "dev"; dev[type] = "mysql"; dev[host] = "localhost"; dev[user] = "user"; dev[password] = "*******"; dev[database] = "database"; dev[charset] = "utf8"; other[type] = "sqlite"; other[database] = PPHP"app.db";
PHP script, (*15)
$db = new DB(); //connecting in a default database (dev) //or $db = DB('other'); //for connect in 'other' (sqlite)
Data componentes (configuration, databases, etc)
MIT
database config data