{"id":16758221,"url":"https://github.com/foo123/dialectorm","last_synced_at":"2026-04-13T11:02:31.531Z","repository":{"id":51536050,"uuid":"301795428","full_name":"foo123/DialectORM","owner":"foo123","description":"Super-simple, fast and versatile Object-Relational-Mapper (ORM) with Relationships and Entity-Attribute-Value and Object-NoSql-Mapper for PHP, Python, JavaScript","archived":false,"fork":false,"pushed_at":"2025-08-19T16:52:36.000Z","size":223,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-19T18:42:31.994Z","etag":null,"topics":["active-record","entity-attribute-value","node-js","nosql-data-storage","object-relational-mapper","orm","php","python","relationships"],"latest_commit_sha":null,"homepage":"https://foo123.github.io/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foo123.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-10-06T16:54:27.000Z","updated_at":"2025-08-19T16:50:26.000Z","dependencies_parsed_at":"2025-07-20T22:09:51.206Z","dependency_job_id":null,"html_url":"https://github.com/foo123/DialectORM","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/foo123/DialectORM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FDialectORM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FDialectORM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FDialectORM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FDialectORM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo123","download_url":"https://codeload.github.com/foo123/DialectORM/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2FDialectORM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31749767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["active-record","entity-attribute-value","node-js","nosql-data-storage","object-relational-mapper","orm","php","python","relationships"],"created_at":"2024-10-13T04:04:31.450Z","updated_at":"2026-04-13T11:02:31.526Z","avatar_url":"https://github.com/foo123.png","language":"PHP","readme":"# DialectORM\n\nSuper-simple, fast and versatile **Object-Relational-Mapper (ORM)** **with Relationships and Entity-Attribute-Value** and **Object-NoSql-Mapper** for PHP, Python, JavaScript\n\n\n![DialectORM](/dialectorm.jpg)\n\nversion **2.1.0**\n\n\n**Dependencies:**\n\n* [Dialect](https://github.com/foo123/Dialect)\n* **PHP: 5.3+**\n* **Python: 3+**\n* **JavaScript: ES7+**\n\n**Supports:**\n\n* **Relational Datastores**: MySql, MariaDB, Postgresql, Sql Server, Sqlite, easily extended to other Relational Stores via adding Dialect configuration\n* **NoSql / Key-Value DataStores**: Redis, easily extended to other NoSql Stores via providing adapter\n\n\n**example (see `/test` folder)**\n\n```php\nclass Post extends DialectORM\n{\n    public static $table = 'posts';\n    public static $pk = ['id'];\n    public static $fields = ['id', 'content'];\n    public static $extra_fields = ['postmeta', 'post_id', 'id', 'key', 'value'];\n    public static $relationships = [];\n\n    public function typeId($x)\n    {\n        return (int)$x;\n    }\n\n    public function typeContent($x)\n    {\n        return (string)$x;\n    }\n\n    public function validateContent($x)\n    {\n        return 0 \u003c strlen($x);\n    }\n}\n\nclass PostStatus extends DialectORM\n{\n    public static $table = 'poststatus';\n    public static $pk = ['id'];\n    public static $fields = ['id', 'status', 'type', 'post_id'];\n    public static $relationships = [];\n\n    public function typeId($x)\n    {\n        return (int)$x;\n    }\n\n    public function typePostId($x)\n    {\n        return (int)$x;\n    }\n\n    public function typeStatus($x)\n    {\n        return strtolower((string)$x);\n    }\n\n    public function typeType($x)\n    {\n        return strtolower((string)$x);\n    }\n\n    public function validateStatus($x)\n    {\n        return in_array($x, ['approved', 'published', 'suspended']);\n    }\n\n    public function validateType($x)\n    {\n        return in_array($x, ['article', 'tutorial', 'general']);\n    }\n}\n\nclass Comment extends DialectORM\n{\n    public static $table = 'comments';\n    public static $pk = ['id'];\n    public static $fields = ['id', 'content', 'post_id'];\n    public static $relationships = [];\n\n    public function typeId($x)\n    {\n        return (int)$x;\n    }\n\n    public function typeContent($x)\n    {\n        return (string)$x;\n    }\n\n    public function typePostId($x)\n    {\n        return (int)$x;\n    }\n\n    public function validateContent($x)\n    {\n        return 0 \u003c strlen($x);\n    }\n}\n\nclass User extends DialectORM\n{\n    public static $table = 'users';\n    public static $pk = ['id'];\n    public static $fields = ['id', 'name'];\n    public static $relationships = [];\n\n    public function typeId($x)\n    {\n        return (int)$x;\n    }\n\n    public function typeName($x)\n    {\n        return (string)$x;\n    }\n\n    public function validateName($x)\n    {\n        return 0 \u003c strlen($x);\n    }\n}\n\nPost::$relationships = [\n    'status' =\u003e ['hasOne', 'PostStatus', ['post_id']],\n    'comments' =\u003e ['hasMany', 'Comment', ['post_id']],\n    'authors' =\u003e ['belongsToMany', 'User', ['user_id'], ['post_id'], 'user_post'],\n];\nPostStatus::$relationships = [\n    'post' =\u003e ['belongsTo', 'Post', ['post_id']]\n];\nComment::$relationships = [\n    'post' =\u003e ['belongsTo', 'Post', ['post_id']],\n];\nUser::$relationships = [\n    'posts' =\u003e ['belongsToMany', 'Post', ['post_id'], ['user_id'], 'user_post'],\n];\n\nfunction output($data)\n{\n    if (is_array($data))\n    {\n        echo json_encode(array_map(function($d){return $d-\u003etoArray(true);}, $data), JSON_PRETTY_PRINT) . PHP_EOL;\n    }\n    elseif ($data instanceof DialectORM)\n    {\n        echo json_encode($data-\u003etoArray(true), JSON_PRETTY_PRINT) . PHP_EOL;\n    }\n    else\n    {\n        echo ((string)$data) . PHP_EOL;\n    }\n}\n\noutput('Posts: ' . (string)Post::count());\noutput('Users: ' . (string)User::count());\n\n$post = Post::fetchAll(['conditions' =\u003e ['content' =\u003e 'a php post..'],'single' =\u003e true]);\nif (empty($post))\n{\n    $post = new Post(['content'=\u003e'a php post..']);\n    $post-\u003esetCustomField1('custom value 1'); // extra custom fields as Entity-Attribute-Value pattern\n    $post-\u003esetComments([new Comment(['content'=\u003e'a php comment..'])]);\n    $post-\u003esetComments([new Comment(['content'=\u003e'one more php comment..'])], ['merge'=\u003etrue]);\n    $post-\u003esetAuthors([new User(['name'=\u003e'a php user'])]);\n    $post-\u003esetStatus(new PostStatus(['status'=\u003e'approved','type'=\u003e'article']));\n    $post-\u003esave(['withRelated'=\u003etrue]);\n}\noutput($post);\n\nprint('Posts:');\noutput(Post::fetchAll([\n    'conditions' =\u003e ['custom_field1' =\u003e 'custom value 1'],\n    'withRelated' =\u003e ['status', 'comments', 'authors'],\n    'related' =\u003e [\n        'authors' =\u003e ['conditions'=\u003e['clause'=\u003e['or'=\u003e[\n            ['name'=\u003e['like'=\u003e'foo']],\n            ['name'=\u003e['like'=\u003e'bar']]\n        ]]]],\n        'comments' =\u003e ['limit'=\u003e1] // eager relationship loading with extra conditions, see `Dialect` lib on how to define conditions\n    ]\n]));\n```\n\n**see also:**\n\n* [ModelView](https://github.com/foo123/modelview.js) a simple, fast, powerful and flexible MVVM framework for JavaScript\n* [tico](https://github.com/foo123/tico) a tiny, super-simple MVC framework for PHP\n* [LoginManager](https://github.com/foo123/LoginManager) a simple, barebones agnostic login manager for PHP, JavaScript, Python\n* [SimpleCaptcha](https://github.com/foo123/simple-captcha) a simple, image-based, mathematical captcha with increasing levels of difficulty for PHP, JavaScript, Python\n* [Dromeo](https://github.com/foo123/Dromeo) a flexible, and powerful agnostic router for PHP, JavaScript, Python\n* [PublishSubscribe](https://github.com/foo123/PublishSubscribe) a simple and flexible publish-subscribe pattern implementation for PHP, JavaScript, Python\n* [Localizer](https://github.com/foo123/Localizer) a simple and versatile localization class (l10n) for PHP, JavaScript, Python\n* [Importer](https://github.com/foo123/Importer) simple class \u0026amp; dependency manager and loader for PHP, JavaScript, Python\n* [EazyHttp](https://github.com/foo123/EazyHttp), easy, simple and fast HTTP requests for PHP, JavaScript, Python\n* [Contemplate](https://github.com/foo123/Contemplate) a fast and versatile isomorphic template engine for PHP, JavaScript, Python\n* [HtmlWidget](https://github.com/foo123/HtmlWidget) html widgets, made as simple as possible, both client and server, both desktop and mobile, can be used as (template) plugins and/or standalone for PHP, JavaScript, Python (can be used as [plugins for Contemplate](https://github.com/foo123/Contemplate/blob/master/src/js/plugins/plugins.txt))\n* [Paginator](https://github.com/foo123/Paginator)  simple and flexible pagination controls generator for PHP, JavaScript, Python\n* [Formal](https://github.com/foo123/Formal) a simple and versatile (Form) Data validation framework based on Rules for PHP, JavaScript, Python\n* [Dialect](https://github.com/foo123/Dialect) a cross-vendor \u0026amp; cross-platform SQL Query Builder, based on [GrammarTemplate](https://github.com/foo123/GrammarTemplate), for PHP, JavaScript, Python\n* [DialectORM](https://github.com/foo123/DialectORM) an Object-Relational-Mapper (ORM) and Object-Document-Mapper (ODM), based on [Dialect](https://github.com/foo123/Dialect), for PHP, JavaScript, Python\n* [Unicache](https://github.com/foo123/Unicache) a simple and flexible agnostic caching framework, supporting various platforms, for PHP, JavaScript, Python\n* [Xpresion](https://github.com/foo123/Xpresion) a simple and flexible eXpression parser engine (with custom functions and variables support), based on [GrammarTemplate](https://github.com/foo123/GrammarTemplate), for PHP, JavaScript, Python\n* [Regex Analyzer/Composer](https://github.com/foo123/RegexAnalyzer) Regular Expression Analyzer and Composer for PHP, JavaScript, Python\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fdialectorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo123%2Fdialectorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fdialectorm/lists"}