2017 © Pedro Peláez
 

library sqlite-dbintrd

image

intrd/sqlite-dbintrd

  • Monday, July 30, 2018
  • by intrd
  • Repository
  • 1 Watchers
  • 3 Stars
  • 75 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

DBIntrd - Simple PHP framework for SQLite3 databases

Tired of spending a lot of time manually creating PHP objects and methods(get/set/save..) to connect a SQLite database?, (*1)

DBIntrd is magic way to automatically create objects and persists data at SQLite3 tables., (*2)

Package details

  • package: DBIntrd
  • version: 1.6
  • category: framework
  • author: intrd - http://dann.com.br
  • see: official post - http://dann.com.br/dbintrd-framework-sqlite-to-php-objects/
  • copyright: 2015 intrd
  • license: Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/
  • link: https://github.com/intrd/sqlite-dbintrd/
  • Dependencies:
  • https://github.com/intrd/php-adminer/

Changelog

  • Github commit log: https://github.com/intrd/sqlite-dbintrd/commits/master

System installation

apt-get update & apt-get upgrade
apt-get install php5-curl php5-sqlite php5-cli

apt-get install git
git clone https://github.com/intrd/sqlite-dbintrd/

Attention: stay outside main project path and clone dependencies.., (*3)

Dependencies installation

git clone [all git dependencies listed at header]
ex: git clone https://github.com/intrd/php-common/

Usage sample (sample.php)

/**
 * sample.php for DBIntrd - Simple SQLite3 PHP Framework
 */

$root=dirname(__FILE__)."/"; //root absolute path
$db_path=$root.'database.dat'; //path of SQLite database.dat (sample database included)
$debug=true; //enable SQL queries debug
require 'dbintrd.php'; //calling DBIntrd Framework

/*
 * GET ALL
 */
$users = new data("users","all"); //GET all data from table=users
vd($users); //print data

/*
 * GET ALL w/ CHILDS data
 */
$users = new data("orders","all",true); //GET all data from table=orders
vd($users); //print data

/*
 * SET and INSERT
 */
$user = new data("users"); //CREATE a fresh new object (table=users structure without data when second argument is null) 
$user->email="another@dann.com.br"; //setting some data...
$user->password="123"; //setting some data...
vd($user);
$user->save(); //INSERT this object on database (null or false = INSERT, true = UPDATE)

/*
 * GET, UPDATE...
 */
$user = new data("users",40); //CREATE an new object w/ database structure+data(table=users WHERE id=40)
$user->{0}->email="newmail@dann.com.br"; //SET a different email to this user
vd($user); //print data
$user->save(true); //UPDATE this object on database (true = UPDATE, null or false = INSERT)

/*
 * GET ALL w/ FILTER
 */
$users = new data("users","filter:email|another@dann.com.br"); //GET an new object w/ database structure+data(table=users WHERE email=another@dann.com.br)
vd($users); //print data

/*
 * GET ALL w/ RAW FILTER
 */
$users = new data("users","filter:email='another@dann.com.br' and email='asd@dann.com.br'"); //GET an new object w/ database structure+data(table=users WHERE email=another@dann.com.br and email='asd@dann.com.br')
vd($users); //print data

/*
 * GET w/ FILTER and CHILDS data
 */
$orders = new data("orders","filter:qty|11",TRUE); 
vd($orders); //print data

/**
 * just a var_dump helper to print out data
 */
function vd($var){ 
  echo"

";var_dump($var);echo"
"; } /** * CUSTOM select sample.. */ $athletes = new data("athletes","custom:SELECT athletes.name,athletes.id,athletes.category FROM athletes WHERE active=1 and category='$category'",false);

Todolist

  • SELECTS are propagating to Childs at application side, do the same at SQLite side w/ a single JOIN query to return child array objects (look nearby DBIntrd.php line 160)

The Versions

30/07 2018

dev-master

9999999-dev

  Sources   Download

03/08 2016

2.0.x-dev

2.0.9999999.9999999-dev http://github.com/intrd/sqlite-dbintrd

DBIntrd - Simple PHP framework for SQLite3 databases. A magic way to automatically create objects and persists data at SQLite3 tables.

  Sources   Download

CC-BY-SA-4.0

The Requires

  • php >=5.3.0

 

database framework php sqlite