All Projects β†’ morris β†’ Lessql

morris / Lessql

Licence: mit
LessQL: A lightweight and performant PHP ORM alternative

Labels

Projects that are alternatives of or similar to Lessql

Gosql
πŸ₯The very simple ORM library for Golang
Stars: ✭ 233 (-39.32%)
Mutual labels:  sql, orm
Data
ATK Data - Data Access Framework for high-latency databases (Cloud SQL/NoSQL).
Stars: ✭ 243 (-36.72%)
Mutual labels:  sql, orm
Sparrow
A simple database toolkit for PHP
Stars: ✭ 236 (-38.54%)
Mutual labels:  sql, orm
Db
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
Stars: ✭ 2,832 (+637.5%)
Mutual labels:  sql, orm
Securitydriven.tinyorm
.NET micro ORM done right.
Stars: ✭ 281 (-26.82%)
Mutual labels:  sql, orm
Quickperf
QuickPerf is a testing library for Java to quickly evaluate and improve some performance-related properties
Stars: ✭ 231 (-39.84%)
Mutual labels:  sql, orm
Sqlhelper
SQL Tools ( Dialect, Pagination, DDL dump, UrlParser, SqlStatementParser, WallFilter, BatchExecutor for Test) based Java. it is easy to integration into any ORM frameworks
Stars: ✭ 242 (-36.98%)
Mutual labels:  sql, orm
Rql
Resource Query Language for REST
Stars: ✭ 190 (-50.52%)
Mutual labels:  sql, orm
Sqlc
Generate type-safe code from SQL
Stars: ✭ 4,564 (+1088.54%)
Mutual labels:  sql, orm
Dapper Plus
Dapper Plus - High-Efficient Bulk Actions (Insert, Update, Delete, and Merge) for .NET
Stars: ✭ 265 (-30.99%)
Mutual labels:  sql, orm
Clear
Advanced ORM between postgreSQL and Crystal
Stars: ✭ 220 (-42.71%)
Mutual labels:  sql, orm
Freezer
A simple & fluent Android ORM, how can it be easier ? RxJava2 compatible
Stars: ✭ 326 (-15.1%)
Mutual labels:  sql, orm
Kuery
Strongly typed SQL in Kotlin
Stars: ✭ 199 (-48.18%)
Mutual labels:  sql, orm
Baby squeel
🐷 An expressive query DSL for Active Record 4 and 5
Stars: ✭ 362 (-5.73%)
Mutual labels:  sql, orm
Grails Data Mapping
GORM - Groovy Object Mapping
Stars: ✭ 194 (-49.48%)
Mutual labels:  sql, orm
Granite
ORM Model with Adapters for mysql, pg, sqlite in the Crystal Language.
Stars: ✭ 238 (-38.02%)
Mutual labels:  sql, orm
Nut
Advanced, Powerful and easy to use ORM for Qt
Stars: ✭ 181 (-52.86%)
Mutual labels:  sql, orm
Jaguar orm
Source-generated ORM with relations (one-to-one, one-to-many, many-to-many), preloading, cascading, polymorphic relations, etc
Stars: ✭ 188 (-51.04%)
Mutual labels:  sql, orm
Xo
Command line tool to generate idiomatic Go code for SQL databases supporting PostgreSQL, MySQL, SQLite, Oracle, and Microsoft SQL Server
Stars: ✭ 2,974 (+674.48%)
Mutual labels:  sql, orm
Rel
πŸ’Ž Modern Database Access Layer for Golang - Testable, Extendable and Crafted Into a Clean and Elegant API
Stars: ✭ 317 (-17.45%)
Mutual labels:  sql, orm

LessQL

Build Status Test Coverage

LessQL is a lightweight and performant alternative to Object-Relational Mapping for PHP.

Guide | Conventions | API Reference | About

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

Installation

Install LessQL via composer: composer require morris/lessql. LessQL requires PHP >= 5.6 and PDO.

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.

Contributors

Thanks!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].