2017 © Pedro Peláez
 

package libcsi

lib csi composer project

image

libcsi/libcsi

lib csi composer project

  • Wednesday, September 6, 2017
  • by dhaim
  • Repository
  • 1 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

libcsi

Simple library for connecting database and create query builder model
version dev-master
* only support mysql/mariadb syntax, (*1)

installatation

It's recommended that you use Composer to install, (*2)

$ composer require libcsi/libcsi "dev-master"  

OR, (*3)

  • create composer.json containing
{
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.3.0",
        "libcsi/libcsi": "dev-master"
    }
}
  • run composer install

usage example

<?php

require_once 'vendor/autoload.php';

// put it somewhere you like  
$config = array (
        'DB' => array (
                'dbdriver' => 'mysql',
                'dbserver' => 'localhost',
                'dbname' => 'dbname',
                'dbuser' => 'dbuser',
                'dbpass' => 'dbpass'
        )
);
$db = new \CSI\Data\DataAdapter ( $config ["DB"] );
try{
    // connect to database
    $db->connect();
}catch(\Exception $e){
    die($e->getMessage());
}

example model

<?php

final class TableTest extends \CSI\Data\Model {
    // name of the table in database
    protected $table="table_test";
    // name of primary key of this table
    protected $primaryKey="id";
}

fetching data using model

$table = new TableTest();  
$table->find("a primary key value");  
$fieldvalue = $table->afiedname;

That's it, (*4)

The Versions

06/09 2017

dev-master

9999999-dev

lib csi composer project

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Avatar dhaim