2017 © Pedro Peláez
 

library lessql

LessQL: The agile PHP ORM alternative

image

morris/lessql

LessQL: The agile PHP ORM alternative

  • Saturday, January 27, 2018
  • by morris
  • Repository
  • 18 Watchers
  • 221 Stars
  • 15,046 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 28 Forks
  • 21 Open issues
  • 13 Versions
  • 16 % Grown

The README.md

LessQL

Build Status Test Coverage, (*1)

LessQL is a lightweight and performant alternative to Object-Relational Mapping for PHP., (*2)

Guide | Conventions | API Reference | About, (*3)

If you are looking for an SQL-based approach superior to raw PDO, check out DOP as an alternative., (*4)

Installation

Install LessQL via composer: composer require morris/lessql. LessQL requires PHP >= 5.6 and PDO., (*5)

Usage

// SCHEMA
// user: id, name
// post: id, title, body, date_published, is_published, user_id
// categorization: category_id, post_id
// category: id, title

// Connection
$pdo = new PDO('sqlite:blog.sqlite3');
$db = new LessQL\Database($pdo);

// Find posts, their authors and categories efficiently:
// Eager loading of references happens automatically.
// This example only needs FOUR queries, one for each table.
$posts = $db->post()
    ->where('is_published', 1)
    ->orderBy('date_published', 'DESC');

foreach ($posts as $post) {
    $author = $post->user()->fetch();

    foreach ($post->categorizationList()->category() as $category) {
        // ...
    }
}

// Saving complex structures is easy
$row = $db->createRow('post', [
    'title' => 'News',
    'body' => 'Yay!',
    'categorizationList' => [
        [
            'category' => ['title' => 'New Category']
        ],
        ['category' => $existingCategoryRow]
    ]
]);

// Creates a post, a new category, two new categorizations
// and connects them all correctly.
$row->save();

Features

  • Efficient deep finding through intelligent eager loading
  • Constant number of queries, no N+1 problems
  • Save complex, nested structures with one method call
  • Convention over configuration
  • Work closely to your database: LessQL is not an ORM
  • No glue code required
  • Clean, readable source code
  • Fully tested with SQLite3, MySQL and PostgreSQL
  • MIT license

Inspired mainly by NotORM, it was written from scratch to provide a clean API and simplified concepts., (*6)

Contributors

Thanks!, (*7)

The Versions

27/01 2018

dev-master

9999999-dev https://github.com/morris/lessql

LessQL: The agile PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

orm database sql pdo notorm

27/01 2018

v0.3.5

0.3.5.0 https://github.com/morris/lessql

LessQL: The agile PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

orm database sql pdo notorm

05/08 2016

dev-next

dev-next http://github.com/morris/lessql

Lightweight PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

orm database sql pdo notorm

06/07 2016

v0.x-dev

0.9999999.9999999.9999999-dev http://github.com/morris/lessql

LessQL: The agile PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

orm database sql pdo notorm

06/07 2016

v0.3.4

0.3.4.0 http://github.com/morris/lessql

LessQL: The agile PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.4

 

The Development Requires

orm database sql pdo notorm

29/05 2016

v0.3.3

0.3.3.0 http://github.com/morris/lessql

LessQL: The agile PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

orm database sql pdo notorm

20/08 2015

v0.3.2

0.3.2.0 http://github.com/morris/lessql

LessQL: The agile PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

orm database sql pdo notorm

20/06 2015

v0.3.1

0.3.1.0 http://github.com/morris/lessql

LessQL: The agile PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

orm database sql pdo notorm

20/05 2015

v0.3.0

0.3.0.0 http://github.com/morris/lessql

LessQL: The agile PHP ORM alternative

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

orm database sql pdo notorm

07/05 2015

v0.2.2

0.2.2.0 http://github.com/morris/lessql

LessQL is a thin but powerful data access layer for SQL databases using PDO.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

orm database sql pdo dal notorm

16/01 2015

v0.2.1

0.2.1.0 http://github.com/morris/lessql

LessQL is a thin but powerful data access layer for SQL databases using PDO.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

orm database sql pdo dal notorm

23/12 2014

v0.2-beta

0.2.0.0-beta http://github.com/morris/lessql

LessQL is a thin but powerful data access layer for SQL databases using PDO.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

orm database sql pdo dal notorm

19/12 2014

v0.1-beta

0.1.0.0-beta http://github.com/morris/lessql

LessQL is a thin but powerful data access layer for SQL databases using PDO.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

orm database sql pdo dal notorm