{"id":18850551,"url":"https://github.com/vollborn/local-db","last_synced_at":"2026-03-07T20:31:49.509Z","repository":{"id":45232051,"uuid":"399922908","full_name":"vollborn/local-db","owner":"vollborn","description":"LocalDB is a small package to read and write JSON files in a Laravel Eloquent like style. ","archived":false,"fork":false,"pushed_at":"2022-08-21T16:29:30.000Z","size":16,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-30T16:39:18.600Z","etag":null,"topics":["composer","database","eloquent","json","laravel","package","packagist","php","php-json"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/vollborn/local-db","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/vollborn.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-08-25T18:40:06.000Z","updated_at":"2023-11-11T16:32:31.000Z","dependencies_parsed_at":"2022-07-18T09:09:10.158Z","dependency_job_id":null,"html_url":"https://github.com/vollborn/local-db","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vollborn/local-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vollborn%2Flocal-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vollborn%2Flocal-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vollborn%2Flocal-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vollborn%2Flocal-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vollborn","download_url":"https://codeload.github.com/vollborn/local-db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vollborn%2Flocal-db/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30229743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"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":["composer","database","eloquent","json","laravel","package","packagist","php","php-json"],"created_at":"2024-11-08T03:29:52.728Z","updated_at":"2026-03-07T20:31:49.474Z","avatar_url":"https://github.com/vollborn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LocalDB\n\nLocalDB is a small package to read and write JSON files in a Laravel Eloquent like style.\n\u003cbr\u003eIt was originally developed for small web servers that cannot connect to classic databases.\n\n\n\u003cbr\u003e\n\n## Installation\n\nThis package ist available via [composer](https://getcomposer.org/).\n\n```shell\ncomposer require vollborn/local-db\n```\n\n\u003cbr\u003e\n\n\n## Configuration\n\n### Set the base path\nIn the base path all json files are stored. The default value is **../storage/local-db**.\n\nYou can change it if you need to:\n```php\nLocalDB::setBasePath(\u003cyour path\u003e);\n```\n\n\n### Register a table\n\nEvery table or json file needs to be registered beforehand.\n\n```php\nLocalDB::table('test', static function (Table $table) {\n    $table-\u003eint('int')-\u003eautoincrements();\n    $table-\u003earray('array')-\u003enullable();\n    $table-\u003eboolean('boolean');\n    $table-\u003efloat('float');\n    $table-\u003estring('string');\n});\n```\n\nAs you can see, there are multiple data types available:\n\n| Name    | Function |\n|---------|----------|\n| Integer | int      |\n| Array   | array    |\n| Boolean | boolean  |\n| Float   | float    |\n| String  | string   |\n\nIn addition, integers can have *autoincrements*.\n\u003cbr\u003eAll data types can also be *nullable*.\n\n\n\u003cbr\u003e\n\n## Usage\n\n\n### Create data\n\n```php\nLocalDB::query('test')-\u003ecreate([\n    'float' =\u003e 1.00,\n    'string' =\u003e null,\n    'boolean' =\u003e false,\n    'array' =\u003e []\n]);\n```\n\n\n### Get data\n\nYou can either get all data...\n```php\nLocalDB::query('test')-\u003eget();\n```\n\nor just the first entry...\n```php\nLocalDB::query('test')-\u003efirst();\n```\n\nThe data can also be filtered.\n```php\nLocalDB::query('test')-\u003ewhere('float', '=', 1.00)-\u003eget();\n```\n\nAvailable operators:\n- =\n- !=\n- \u003c\n- \\\u003e\n- \u003c=\n- \\\u003e=\n\nFurthermore, the data can be ordered.\n```php\n// ascending\nLocalDB::query('test')-\u003eorderBy('float')-\u003eget();\n\n// descending\nLocalDB::query('test')-\u003eorderBy('float', true)-\u003eget();\n```\n\nThere are some numeric operations available too.\n```php\n// minimal value\nLocalDB::query('test')-\u003emin('float');\n\n// maximal value\nLocalDB::query('test')-\u003emax('float');\n\n// average value\nLocalDB::query('test')-\u003eavg('float');\n\n// summed value\nLocalDB::query('test')-\u003esum('float');\n```\n\n\n### Update data\n\n```php\nLocalDB::query('test')\n    -\u003ewhere('boolean', '=', false)\n    -\u003eupdate([\n        'boolean' =\u003e true\n    ]);\n```\n\n\n### Delete data\n\n```php\nLocalDB::query('test')\n    -\u003ewhere('boolean', '=', false)\n    -\u003edelete();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvollborn%2Flocal-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvollborn%2Flocal-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvollborn%2Flocal-db/lists"}