{"id":13593549,"url":"https://github.com/morris/lessql","last_synced_at":"2025-05-15T09:08:29.395Z","repository":{"id":24632159,"uuid":"28041363","full_name":"morris/lessql","owner":"morris","description":"LessQL: A lightweight and performant PHP ORM alternative","archived":false,"fork":false,"pushed_at":"2022-12-10T14:23:12.000Z","size":188,"stargazers_count":409,"open_issues_count":14,"forks_count":40,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-14T15:56:50.086Z","etag":null,"topics":["orm","php","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morris.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-15T14:58:32.000Z","updated_at":"2025-03-30T14:05:26.000Z","dependencies_parsed_at":"2023-01-14T01:19:49.271Z","dependency_job_id":null,"html_url":"https://github.com/morris/lessql","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morris%2Flessql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morris%2Flessql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morris%2Flessql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morris%2Flessql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morris","download_url":"https://codeload.github.com/morris/lessql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310520,"owners_count":22049470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["orm","php","sql"],"created_at":"2024-08-01T16:01:21.474Z","updated_at":"2025-05-15T09:08:24.386Z","avatar_url":"https://github.com/morris.png","language":"PHP","readme":"# LessQL\n\n[![Build Status](https://travis-ci.org/morris/lessql.svg?branch=master)](https://travis-ci.org/morris/lessql)\n[![Test Coverage](https://codeclimate.com/github/morris/lessql/badges/coverage.svg)](https://codeclimate.com/github/morris/lessql/coverage)\n\nLessQL is a lightweight and performant alternative to Object-Relational Mapping for PHP.\n\n**[Guide](doc/guide.md) | [Conventions](doc/conventions.md) | [API Reference](doc/api.md) | [About](doc/about.md)**\n\n*If you are looking for an SQL-based approach superior to raw PDO, check out [DOP](https://github.com/morris/dop) as an alternative.*\n\n## Installation\n\nInstall LessQL via composer: `composer require morris/lessql`.\nLessQL requires PHP \u003e= 5.6 and PDO.\n\n## Usage\n\n```php\n// SCHEMA\n// user: id, name\n// post: id, title, body, date_published, is_published, user_id\n// categorization: category_id, post_id\n// category: id, title\n\n// Connection\n$pdo = new PDO('sqlite:blog.sqlite3');\n$db = new LessQL\\Database($pdo);\n\n// Find posts, their authors and categories efficiently:\n// Eager loading of references happens automatically.\n// This example only needs FOUR queries, one for each table.\n$posts = $db-\u003epost()\n    -\u003ewhere('is_published', 1)\n    -\u003eorderBy('date_published', 'DESC');\n\nforeach ($posts as $post) {\n    $author = $post-\u003euser()-\u003efetch();\n\n    foreach ($post-\u003ecategorizationList()-\u003ecategory() as $category) {\n        // ...\n    }\n}\n\n// Saving complex structures is easy\n$row = $db-\u003ecreateRow('post', [\n    'title' =\u003e 'News',\n    'body' =\u003e 'Yay!',\n    'categorizationList' =\u003e [\n        [\n            'category' =\u003e ['title' =\u003e 'New Category']\n        ],\n        ['category' =\u003e $existingCategoryRow]\n    ]\n]);\n\n// Creates a post, a new category, two new categorizations\n// and connects them all correctly.\n$row-\u003esave();\n```\n\n## Features\n\n- Efficient deep finding through intelligent eager loading\n- Constant number of queries, no N+1 problems\n- Save complex, nested structures with one method call\n- Convention over configuration\n- Work closely to your database: LessQL is not an ORM\n- No glue code required\n- Clean, readable source code\n- Fully tested with SQLite3, MySQL and PostgreSQL\n- MIT license\n\nInspired mainly by [NotORM](https://www.notorm.com/),\nit was written from scratch to provide a clean API and simplified concepts.\n\n## Contributors\n\n- [jayaddison](https://github.com/jayaddison)\n- [f0ma](https://github.com/f0ma)\n\nThanks!\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorris%2Flessql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorris%2Flessql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorris%2Flessql/lists"}