2017 © Pedro Peláez
 

library phpdatabase

This package contains simple to use database access layer.

image

joefallon/phpdatabase

This package contains simple to use database access layer.

  • Wednesday, July 20, 2016
  • by jfallon
  • Repository
  • 1 Watchers
  • 0 Stars
  • 102 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 19 Versions
  • 0 % Grown

The README.md

phpdatabase

By Joe Fallon, (*1)

A simple library for MySQL database access. It has the following features:, (*2)

  • Full suite of unit tests.
  • It can be integrated into any existing project.
  • Can be fully understood in just a few moments.
  • The library implements the data mapper design patter (a.k.a. table gateway).

Installation

The easiest way to install PhpDatabase is with Composer. Create the following composer.json file and run the php composer.phar install command to install it., (*3)

{
    "require": {
        "joefallon/phpdatabase": "*"
    }
}

Usage

There are four main classes are are used to represent all of the relationships within a database:, (*4)

  • AbstractTableGateway
  • AbstractJoinTableGateway
  • PdoFactory

Entities

An entity is a class that represents a single row within a database. All entities must contain a primary key feild and optionally a created at and updated at field:, (*5)

  • primary key - This is the primary key of the row. It can be named anything.
  • created at - This is the date and time that the row was created. It can be named anything.
  • updated at - This is the date and time that the row was last updated. It can be named anything.

Additional data fields are added to the entity. Each data field that is added to the entity and should correlate one-to-one with columns within a given table., (*6)

Abstract Table Gateway

Instances of subclasses of AbstractTableGateway are used to mediate all access to a table within the database., (*7)

Each subclass must implement the abstract methods mapObjectToArray and mapArrayToObject. The method mapObjectToArray is used to convert an entity to an associative array. The names of the keys map to the column names within the database. The method mapArrayToObject is used to convert an associative array that was retrieved from the database into an object., (*8)

Additionally, several methods are provided to assist with access to the database. There are four major methods that are used to provide the basic CRUD (i.e. Create, Retrieve, Update, Delete) access to the database. The the following methods are used to provide public access:, (*9)

  • baseCreate($entity)
  • baseRetrieve($id)
  • baseUpdate($entity)
  • baseDelete($id)

Abstract Join-Table Gateway

The class AbstractJoinTableGateway is used mediate access to join tables (i.e. junction table). These tables to represent many-to-many associations., (*10)

PDO Factory

The PdoFactory factory class is used to create a PHP PDO object., (*11)

Usage

Please refer to the unit tests for a detailed example of how to use this package., (*12)

The Versions

20/07 2016

dev-master

9999999-dev https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database

20/07 2016

dev-develop

dev-develop https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database

20/07 2016

v7.0.0

7.0.0.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database

25/01 2016

v6.0.0

6.0.0.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database

18/01 2016

v5.0.2

5.0.2.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database

03/01 2016

v5.0.1

5.0.1.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

database

03/01 2016

v5.0.0

5.0.0.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer.

  Sources   Download

MIT

The Requires

 

The Development Requires

database

23/10 2015

v4.0.1

4.0.1.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

29/09 2015

v4.0.0

4.0.0.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

28/09 2015

v3.0.2

3.0.2.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

20/09 2015

v3.0.1

3.0.1.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

25/08 2015

v3.0.0

3.0.0.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

05/02 2015

v2.0.3

2.0.3.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

28/01 2015

v2.0.2

2.0.2.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

09/12 2014

v2.0.1

2.0.1.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

29/10 2014

v2.0.0

2.0.0.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

20/10 2014

v1.0.2

1.0.2.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

20/10 2014

v1.0.1

1.0.1.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal

29/08 2014

v1.0.0

1.0.0.0 https://github.com/joefallon/phpdatabase

This package contains simple to use database access layer that eschews the ORM mentality.

  Sources   Download

MIT

The Requires

 

The Development Requires

database php dbal