{"id":41214948,"url":"https://github.com/phore/phore-dba","last_synced_at":"2026-01-22T23:58:42.353Z","repository":{"id":57039179,"uuid":"142138010","full_name":"phore/phore-dba","owner":"phore","description":"database abstraction layer ","archived":false,"fork":false,"pushed_at":"2019-08-08T08:05:08.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T09:06:03.268Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/phore.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}},"created_at":"2018-07-24T09:43:35.000Z","updated_at":"2019-08-08T08:05:10.000Z","dependencies_parsed_at":"2022-08-23T23:31:00.323Z","dependency_job_id":null,"html_url":"https://github.com/phore/phore-dba","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phore/phore-dba","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phore%2Fphore-dba","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phore%2Fphore-dba/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phore%2Fphore-dba/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phore%2Fphore-dba/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phore","download_url":"https://codeload.github.com/phore/phore-dba/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phore%2Fphore-dba/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28675277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T20:48:19.482Z","status":"ssl_error","status_checked_at":"2026-01-22T20:48:14.968Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2026-01-22T23:58:41.689Z","updated_at":"2026-01-22T23:58:42.348Z","avatar_url":"https://github.com/phore.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phore Dba (DatabaseAbstraction)\n\n## TL;DR;\n\nPhore-dba is a very simple Object-Relational Mapper for PHP 7.\n\nIt will map Objects to Tables using exact the same Names.\n\n- It will work with mysqli, sql, and PDO in gerneral.\n- Update only changed properties\n- [See sqlite3 example](examples/sqlite-create-table.php)\n\n\n## Installation  \n\nInstall  using composer:\n\n```\ncomposer require phore/dba\n```\n\n\n## Example\n\n- Create as Entity Class `SomeEntity` and define `__META__` data\n- Initialize a Sqlite Connection to `/path/to/sqlite.db3`\n- Create a Table `SomeEntity`\n- Insert a new Entity for `name: someName` and `company: SomeCompany`\n- `query()` all Entities and map them back to Entity using `each(callable $fn)`\n- `update()` each entity, then `delete()` it (hm - it's just a demo)\n\n```php\nclass SomeEntity {\n    use Entity;\n    const __META__ = [ \"primaryKey\" =\u003e \"id\" ];\n    public $id;\n    public $name;\n    public $company;\n}\n\n$odb = PhoreDba::InitDSN(\"sqlite:/path/to/sqlite.db3\");\n// Use multi_query() to execute multiple Statements\n$odb-\u003emulti_query (\"CREATE TABLE IF NOT EXISTS SomeEntity (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    name TEXT,\n    company TEXT\n);\");\n\n$odb-\u003einsert(new SomeEntity([\"name\"=\u003e\"someName\", \"company\"=\u003e\"SomeCompany\"]));\n\n$odb-\u003equery(\"SELECT * FROM SomeEntity WHERE name=?\", [\"UnescapedValue\"])-\u003eeach(\n    function (array $row) use ($odb) {\n        print_r ($entity = SomeEntity::Load($row[\"id\"]);\n        $entity-\u003ename = \"MyNewName\";\n        $odb-\u003eupdate($entity);\n        $odb-\u003edelete($entity);\n    }\n);\n```\n\n\n\n## Loading from Database\n\n```php\n$entity = $odb-\u003eload(SomeEntity::class, 103878);\n```\n\nor - with object casting (IDE Code-Completion):\n\n```php\n$entity = SomeEntity::Load(103878);\n```\n\n\n\n## Working with entities\n\nEntities must be loaded calling the `load()` method, so the framework\ncan track changes. You should use `query()` only to retrieve Id's and\nload the entities afterwards. \n\n### Changed fields\n\n```php\n$entity = SomeEntity::Load(1234); // Shortcut\n$entity-\u003ename = \"new Name\";\nassert ($enetity-\u003eisChanged(\"name\") === true)\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphore%2Fphore-dba","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphore%2Fphore-dba","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphore%2Fphore-dba/lists"}