{"id":36995991,"url":"https://github.com/porebskk/simple-php-document-store","last_synced_at":"2026-01-13T23:48:20.482Z","repository":{"id":57043725,"uuid":"137647895","full_name":"porebskk/simple-php-document-store","owner":"porebskk","description":"SimplePhpDocumentStore is a simple NoSQL database for storing php arrays and querying them.","archived":false,"fork":false,"pushed_at":"2018-06-26T19:00:30.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-24T13:32:34.026Z","etag":null,"topics":["database","dbal","documentation","nosql","php","sqlite"],"latest_commit_sha":null,"homepage":null,"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/porebskk.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-17T10:51:32.000Z","updated_at":"2018-07-01T09:23:04.000Z","dependencies_parsed_at":"2022-08-24T04:50:43.493Z","dependency_job_id":null,"html_url":"https://github.com/porebskk/simple-php-document-store","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/porebskk/simple-php-document-store","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porebskk%2Fsimple-php-document-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porebskk%2Fsimple-php-document-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porebskk%2Fsimple-php-document-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porebskk%2Fsimple-php-document-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/porebskk","download_url":"https://codeload.github.com/porebskk/simple-php-document-store/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/porebskk%2Fsimple-php-document-store/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"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":["database","dbal","documentation","nosql","php","sqlite"],"created_at":"2026-01-13T23:48:20.397Z","updated_at":"2026-01-13T23:48:20.464Z","avatar_url":"https://github.com/porebskk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimplePhpDocumentStore\nSimplePhpDocumentStore is a simple document store (fancy words for storing php arrays) that is \nrunning sql under the hood. It also provides a query component using paths extracted from the\ndocument. The querying part is solved by doing extra lifting when the\ndocuments are stored in the database (storing all unique paths as separate\nvalues).\n\n## Installation\n`composer require porebskk/simple-php-document-store`\n\n## Features\n* A variety of database platforms are supported via [DBAL](https://www.doctrine-project.org/projects/doctrine-dbal/en/2.7/reference/platforms.html#platforms)\n* JSON-Path Query Builder\n\n## Usage\n### Initialization\n```php\n//Setting up the DbalAdapter, we are using here Sqlite in memory mode\n//requires the sqlite extension to be enabled in the used php.ini file\n$connectionParams = ['url' =\u003e 'sqlite:///:memory:'];\n$conn = DriverManager::getConnection($connectionParams);\n$conn-\u003eexec('PRAGMA foreign_keys = ON');\n$dbalAdapter = new DbalAdapter($conn);\n\n//this is only required once for persistence storages\n$dbalAdapter-\u003einitDataStructure();\n```\n### Storage\n```php\n$document = [\n    'person' =\u003e [\n        'head' =\u003e [\n            'nose' =\u003e 'big',\n            'eyes' =\u003e 'blue',\n        ],\n    ],\n];\n\n$documentId = $dbalAdapter-\u003estore($document);\n```\n### Querying (by ID)\n```php\n$documentId = $dbalAdapter-\u003estore($document);\n\n$document = $dbalAdapter-\u003esearchById($documentId);\n```\n### Querying (with a QueryObject)\n```php\n$query = new Query();\n//Finding document where the JSON Path \"person.head.eyes\" is either red or orange\n//Allowed operators depend on the adapter implementation\n//for DBAL see the ExpressionBuilder::* constants\n$query-\u003ewhereAnd(\n    (new OrStatement())-\u003eadd(\n        new WhereStatement('person.head.eyes', '=', 'red'),\n        new WhereStatement('person.head.eyes', '=', 'orange')\n    )\n);\n\n$documents = $dbalAdapter-\u003esearchByQuery($query);\n\n//It is possible to wrap AND/OR Statement as deep as possible\n$query-\u003ewhereAnd(\n    (new OrStatement())-\u003eadd(\n        new WhereStatement('person.head.eyes', '=', 'blue'),\n        (new AndStatement())-\u003eadd(\n            new WhereStatement('person.head.eyes', '=', 'orange'),\n            new WhereStatement('person.character.crazy', '=', 'yes')\n        )\n    ),\n    new WhereStatement('person.feet', '=', 'big')\n);\n```\n### Updating a document\n```php\n$dbalAdapter-\u003eupdate($documentId, $updatedDocument);\n```\n\n### Limit the amount of returned documents\n```php\n$query = (new Query())-\u003elimit(5);\n\n$maximumOf5Documents = $dbalAdapter-\u003esearchByQuery($query);\n```\n\n### Advanced Usage\nStoring documents with array data and querying them:\n```php\n$document = [\n    'friends' =\u003e [\n        ['person' =\u003e ['name' =\u003e 'Bob', 'age' =\u003e 26]],\n        ['person' =\u003e ['name' =\u003e 'Alice', 'age' =\u003e 25]],\n    ],\n];\n\n$dbalAdapter-\u003estore($document);\n\n//Following paths will be extracted from the array:\n//'friends.person.name' =\u003e 'Bob',\n//'friends.person.age' =\u003e 26\n//'friends.person.name' =\u003e 'Alice'\n//'friends.person.age' =\u003e 25\n\n//Now we query the data\n$query = new Query();\n$query-\u003ewhereAnd(\n    new WhereStatement('friends.person.age', '\u003c', '30')\n);\n\n$documents = $dbalAdapter-\u003esearchByQuery($query);\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporebskk%2Fsimple-php-document-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fporebskk%2Fsimple-php-document-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fporebskk%2Fsimple-php-document-store/lists"}