2017 © Pedro Peláez
 

library data

Data componentes (configuration, databases, etc)

image

neos/data

Data componentes (configuration, databases, etc)

  • Thursday, April 17, 2014
  • by pedra
  • Repository
  • 0 Watchers
  • 1 Stars
  • 54 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 4 % Grown

The README.md

Config

Config for Start PHP, (*1)

[2014/01/30] add data base access point by PDO., (*2)

Examples

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)

The Versions

17/04 2014

dev-master

9999999-dev http://github.com/pedra/Data

Data componentes (configuration, databases, etc)

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

database config data