soneritics/database

Soneritics Database framework for PHP 5.5 and higher.

Maintainers

👁 soneritics

Package info

github.com/Soneritics/Database

Homepage

pkg:composer/soneritics/database

Statistics

Installs: 150

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

1.3.4 2022-02-20 20:25 UTC

Requires

  • php: >=5.5.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 350c9750e29ec5ad5bebc18227f9d8a4675c25d2

This package is auto-updated.

Last update: 2026-06-21 06:13:49 UTC


README

👁 Build Status
👁 Coverage Status
👁 License

by

Introduction

Soon..

Minimum Requirements

  • PHP 5.5+
  • PDO driver for your respective database (atm only MySQL is supported)

Supported Databases

  • MySQL

Features

  • Much

Database querying

Database querying is very easy. A few examples can be found in the code below.

// Define the tables we have as Table extends
class Father extends Table {}
class Mother extends Table {}
class Child extends Table {}

// Use the Child table as a base for the queries
$child = new Child;

// Select everything from the children table
$child
 ->select()
 ->execute();

// Join a child with it's parents
$child
 ->select()
 ->leftJoin(new Father, 'Father.id = father_id')
 ->leftJoin(new Mother, 'Mother.id = mother_id')
 ->execute();

// A new child has been born!
$child
 ->insert()
 ->values([
 'firstname' => 'first name',
 'lastname' => 'last name',
 'father_id' => 1,
 'mother_id' => 1
 ])
 ->execute();

// Typo in the baby's name :-)
$child
 ->update()
 ->set('firstname', 'new first name')
 ->where([
 'firstname' => 'first name',
 'lastname' => 'last name'
 ])
 ->execute();

// Typo in the first and lastname of the baby :O
$child
 ->update()
 ->set(['firstname' => 'new first name', 'lastname' => 'new last name'])
 ->where([
 'firstname' => 'first name',
 'lastname' => 'last name'
 ])
 ->execute();

// Selecting with some sorting and limiting
$child
 ->select()
 ->leftJoin(new Father, 'Father.id = father_id')
 ->leftJoin(new Mother, 'Mother.id = mother_id')
 ->orderAsc('lastname')
 ->orderAsc('firstname')
 ->limit(25)
 ->execute();