{"id":15190065,"url":"https://github.com/nzsakib/db-config","last_synced_at":"2026-03-03T18:01:15.988Z","repository":{"id":57029614,"uuid":"229949478","full_name":"nzsakib/db-config","owner":"nzsakib","description":"Package for storing laravel config details in database","archived":false,"fork":false,"pushed_at":"2020-01-04T09:39:27.000Z","size":334,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-27T23:08:05.502Z","etag":null,"topics":["configuration-management","database","environment","laravel","php"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/nzsakib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-24T13:46:32.000Z","updated_at":"2020-01-04T09:39:30.000Z","dependencies_parsed_at":"2022-08-23T18:50:23.549Z","dependency_job_id":null,"html_url":"https://github.com/nzsakib/db-config","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nzsakib/db-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzsakib%2Fdb-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzsakib%2Fdb-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzsakib%2Fdb-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzsakib%2Fdb-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nzsakib","download_url":"https://codeload.github.com/nzsakib/db-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nzsakib%2Fdb-config/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30053984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T17:46:22.538Z","status":"ssl_error","status_checked_at":"2026-03-03T17:46:22.036Z","response_time":61,"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":["configuration-management","database","environment","laravel","php"],"created_at":"2024-09-27T20:04:07.033Z","updated_at":"2026-03-03T18:01:15.967Z","avatar_url":"https://github.com/nzsakib.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Very short description of the package\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/nzsakib/db-config.svg?style=flat-square)](https://packagist.org/packages/nzsakib/db-config)\n[![Build Status](https://img.shields.io/travis/nzsakib/db-config/master.svg?style=flat-square)](https://travis-ci.org/nzsakib/db-config)\n[![Quality Score](https://img.shields.io/scrutinizer/g/nzsakib/db-config.svg?style=flat-square)](https://scrutinizer-ci.com/g/nzsakib/db-config)\n[![Total Downloads](https://img.shields.io/packagist/dt/nzsakib/db-config.svg?style=flat-square)](https://packagist.org/packages/nzsakib/db-config)\n\nThis is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require nzsakib/db-config\n```\n\n## Usage\n\n#### Facade or Implementation Class? \nYou can either use facade or direct implementation class to work. \n```php \n// You can use following facade\n\\Nzsakib\\DbConfig\\Facades\\CustomConfig::getCollection();\n// Or you can use the implementation below \n(new \\Nzsakib\\DbConfig\\DbConfig())-\u003egetCollection();\n```\n\n#### Get All Configurations as collection from DB \n```php \nuse Nzsakib\\DbConfig\\DbConfig;\n\n$config = new DbConfig;\n$allConfig = $config-\u003egetCollection(); // returns Model collection of specified table\n\n// pass to blade or do your thing by looping \nforeach($allConfig as $config) {\n    dump($config-\u003ename);\n    dump($config-\u003evalue);\n}\n```\n#### Set a new config \n``` php\nuse Nzsakib\\DbConfig\\DbConfig;\n\n$config = new DbConfig; \n$name = 'facebook';\n$value = [\n    'client_id' =\u003e 'a client id',\n    'client_secret' =\u003e 'client secret',\n];\n// Value could be any data type e.g. boolean/array/string/integer\n\ntry {\n    $newConfig = $config-\u003eset($name, $value); \n    // new config is set and cache is invalidated \n} catch (\\InvalidArgumentException $e) {\n    // redirect with message $e-\u003egetMessage() \n}\n```\n#### Update existing DB config \nCache will be deleted automatically after successfull update.\n```php \nuse Nzsakib\\DbConfig\\DbConfig;\nuse Illuminate\\Database\\Eloquent\\ModelNotFoundException;\n\n$config = new DbConfig;\n\n$name = 'facebook';\n$newValue = [\n    'client_id' =\u003e 'updated client id',\n    'client_secret' =\u003e 'updated secret'\n];\n\ntry {\n    $updatedConfig = (new DbConfig)-\u003eupdateByName($name, $newValue); \n    // Updated model is returned \n} catch (ModelNotFoundException $e) {\n    // Specified name does not exists in database\n}\n\n// Or you could update by `id` which is primary key \ntry {\n    $updatedConfig = (new DbConfig)-\u003eupdateById($id, $name, $newValue);\n    // Updated model is returned \n} catch (ModelNotFoundException $e) {\n    // Specified id does not exists in database\n}\n```\n\n#### Delete a DB Config\nCache will be deleted automatically after successfull delete.\n```php \nuse Nzsakib\\DbConfig\\DbConfig;\nuse Illuminate\\Database\\Eloquent\\ModelNotFoundException;\n\n$name = 'facebook';\ntry {\n    $deletedConfig = (new DbConfig)-\u003edeleteByName($name);\n    // deleted successfully \n} catch (ModelNotFoundException $e) {\n    // specified name does not exists in database \n}\n\n// Or delete the config by primary key `id` \n$id = request('id'); \ntry {\n    $deletedConfig = (new DbConfig)-\u003edeleteById($id);\n    // deleted successfully \n} catch (ModelNotFoundException $e) {\n    // specified id does not exists in database \n}\n```\n#### Get Eloquent DB Query to Work With Data \n```php\nuse Nzsakib\\DbConfig\\DbConfig;\n\n$query = (new DbConfig)-\u003egetQuery(); \n// Returns Builder instance to underlying config table Model\n// You can run custom query on it \n$query-\u003ewhere('name', 'facebook')-\u003edelete();\n// facebook config row is deleted from DB\n\n```\n\n## Publish the package config and migration files\n```bash \nphp artisan vendor:publish --provider=\"Nzsakib\\DbConfig\\DbConfigServiceProvider\" --tag=\"config\"\nphp artisan vendor:publish --provider=\"Nzsakib\\DbConfig\\DbConfigServiceProvider\" --tag=\"migrations\"\n```\n\nYou can change table name of the migration file, but make sure you mention the updated table name in the config file.\n\n### Testing\n\n``` bash\ncomposer test\n```\n\n### Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n### Security\n\nIf you discover any security related issues, please email sukku.mia@gmail.com instead of using the issue tracker.\n\n## Credits\n\n- [Nazmus Sakib](https://github.com/nzsakib)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## Laravel Package Boilerplate\n\nThis package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzsakib%2Fdb-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnzsakib%2Fdb-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnzsakib%2Fdb-config/lists"}