2017 © Pedro Peláez
 

library simple-database-api

Simple API for Database Access

image

dboho/simple-database-api

Simple API for Database Access

  • Thursday, March 29, 2018
  • by dBoho
  • Repository
  • 1 Watchers
  • 0 Stars
  • 89 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 3 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

DBoho\IO\DataAccess

Build Status Coverage Status, (*1)

A simple API for Database Access, (*2)

Features

  • Simple API
  • prevent SQL injection with automatic whitelist column filter and pdo prepared statements

Install with Composer

$ composer require dboho/simple-database-api

Usage

# select
$result = $da->select('books', ['title'], ['author'=>'Rasmus Lerdorf']);
echo(json_encode($result));

# insert
$da->insert('books', ['title'=>'Using the New DB2', 'author'=>'Don Chamberlin']);

# update
$da->update('books', ['price'=>9.80], ['id'=>1023]);

# delete
$da->delete('books', ['id'=>1021]);

Automatic Whitelist Column Filter

To prevent SQL injection all attributes that are used as column names will be filtered with a whitelist. This whitelist is build for each queried database table., (*3)

Example

Books Table, (*4)

id title author price
1 Programming PHP Rasmus Lerdorf 39.99

Whitelist for the books table will contain id, title, author and price., (*5)

The Versions

29/03 2018

dev-master

9999999-dev

Simple API for Database Access

  Sources   Download

MIT

The Requires

  • php ~5.5 || ~7.0

 

The Development Requires

by David Wiesner

database api simple