{"id":20639210,"url":"https://github.com/alexdremov/daim","last_synced_at":"2026-04-22T10:33:52.623Z","repository":{"id":56944458,"uuid":"235904672","full_name":"alexdremov/DAIM","owner":"alexdremov","description":"Lightweight and efficient MySQL PHP requests framework","archived":false,"fork":false,"pushed_at":"2020-08-25T07:08:49.000Z","size":142,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T06:41:09.319Z","etag":null,"topics":["beta","daim","db","php","querybuilder","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/alexdremov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-23T23:10:29.000Z","updated_at":"2021-05-21T13:09:08.000Z","dependencies_parsed_at":"2022-08-21T07:20:15.881Z","dependency_job_id":null,"html_url":"https://github.com/alexdremov/DAIM","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/alexdremov/DAIM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdremov%2FDAIM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdremov%2FDAIM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdremov%2FDAIM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdremov%2FDAIM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexdremov","download_url":"https://codeload.github.com/alexdremov/DAIM/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdremov%2FDAIM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32132528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T08:34:57.708Z","status":"ssl_error","status_checked_at":"2026-04-22T08:34:55.583Z","response_time":58,"last_error":"SSL_read: 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":["beta","daim","db","php","querybuilder","sql"],"created_at":"2024-11-16T15:23:00.062Z","updated_at":"2026-04-22T10:33:52.608Z","avatar_url":"https://github.com/alexdremov.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DAIM\n![](https://img.shields.io/badge/status-beta-red)\n![](https://img.shields.io/circleci/build/github/AlexRoar/DAIM/master)\n![](https://img.shields.io/github/repo-size/AlexRoar/DAIM)\n![](https://img.shields.io/github/last-commit/AlexRoar/DAIM)\n\nThe framework is designed to minimize usage of SQL code in interactions between MySQL server and PHP scripts; to bind PHP object alterations with DB alterations.\n\n## Why it is gorgeous?\n\n- Reactive models. You change PHP model — Database changes automatically.\n- Generates PHP classes according to existing tables, helps your IDE with suggestions.\n- Keeps connections efficient, as it uses only one active MySQL connection throughout all interactions.\n- Keeps connections to multiple databases organized.\n- Automatic prevention of SQL-injections.\n\n## Installation\n\nJust use [composer](https://getcomposer.org).\n```bash\ncomposer require alexdremov/daim\n```\n\n## Usage\n\nYou can use it for keeping your Database connections organized and single.\nAt first, you need to setup the framework:\n```php\nuse DAIM\\Core\\Connection;\nuse DAIM\\Core\\Credentials;\n\n$cred = new Credentials();\n$cred-\u003esetHost(host);\n$cred-\u003esetUsername(username);\n$cred-\u003esetDBname(DBname);\n$cred-\u003esetPassword(password);\n$cred-\u003esetPort(port);\n\nConnection::setCredentials($cred);\nConnection::initConnection();\n\nConnection::getConnection(); # returns active MySQL connection (instance of mysqli class);\n\n# To set up a second connection (maybe to the second database),\n# you can create additional connection mode:\n\n/**\n * Set up $cred2 as instance of Credentials class for the second connection\n * @var $cred2 Credentials;\n */\n\nConnection::setCredentials($cred2, \"secondConnectionName\");\nConnection::initConnection(\"secondConnectionName\");\n```\n\nNow we are ready to go.\n```php\n// Basic raw query.\nConnection::query('SELECT * FROM `Persons` WHERE 1', \"secondConnectionName\");\n```\n\nCurrently, I am working on Query Builder. The project's state is beta, but some features are already available:\n\nSELECT:\n```php\nuse DAIM\\Core\\QueryBuilder;\nuse DAIM\\Syntax\\SQLEntities\\Conditions;\n\n$qb = new QueryBuilder();\n$result = $qb-\u003eselect('*')-\u003efrom('Information')-\u003erequest();\n\n# Or more complicated usage:\n\n$result = $qb-\u003eselect(\n    'Persons.LastName', 'Persons.PersonID', 'Information.Tel'\n)-\u003efrom(\n    'Information', 'Persons'\n)-\u003ewhere(\n    (new Conditions())-\u003efield('Information.PersonID')-\u003eequal()-\u003efield('Persons.PersonID')\n)-\u003erequest();\n\n# Generates SQL\n# SELECT Persons.LastName, Persons.PersonID, Information.Tel FROM Information, Persons WHERE Information.PersonID = Persons.PersonID\n# final -\u003erequest() returns instance of QueryResult class.\n```\nINSERT:\n```php\nuse DAIM\\Core\\QueryBuilder;\n\n$qb = new QueryBuilder();\n\n$qb-\u003einsertInto('tableName', array(\n\"field1\"=\u003e\"value1\",\n\"field2\"=\u003e\"value2\"\n));\n$response = $qb-\u003erequest(); // Commit changes\n\n// Or longer version:\n\n$qb-\u003einsertInto('tableName')-\u003ecolumns('field1', 'field2', 'field3')-\u003evalues('value1', 'value2', 'value3')-\u003erequest();\n$qb-\u003einsertInto('tableName')-\u003evalues('value1', 'value2', 'value3')-\u003erequest();\n```\nSubqueries are also available in INSERT builder.\n\nSuch limited library usage is due to the beta status of the project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdremov%2Fdaim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexdremov%2Fdaim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdremov%2Fdaim/lists"}