{"id":20806489,"url":"https://github.com/elipzis/laravel-simple-setting","last_synced_at":"2026-03-09T23:04:48.002Z","repository":{"id":41883231,"uuid":"441388444","full_name":"elipZis/laravel-simple-setting","owner":"elipZis","description":"⚙️ Simple key/value typed settings for your Laravel app with synchronized json export","archived":false,"fork":false,"pushed_at":"2025-08-18T02:07:46.000Z","size":120,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-30T14:44:19.558Z","etag":null,"topics":["laravel","php"],"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/elipZis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"elipZis"}},"created_at":"2021-12-24T06:41:14.000Z","updated_at":"2025-06-16T05:24:13.000Z","dependencies_parsed_at":"2024-04-22T11:25:48.310Z","dependency_job_id":"cd1aef20-1dfa-4468-beb8-6804d01f1cfc","html_url":"https://github.com/elipZis/laravel-simple-setting","commit_stats":{"total_commits":35,"total_committers":3,"mean_commits":"11.666666666666666","dds":0.6,"last_synced_commit":"7762f903799c2956ae9b4d999fff1307bf2f11d7"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/elipZis/laravel-simple-setting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elipZis%2Flaravel-simple-setting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elipZis%2Flaravel-simple-setting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elipZis%2Flaravel-simple-setting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elipZis%2Flaravel-simple-setting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elipZis","download_url":"https://codeload.github.com/elipZis/laravel-simple-setting/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elipZis%2Flaravel-simple-setting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274038636,"owners_count":25211900,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["laravel","php"],"created_at":"2024-11-17T19:20:21.114Z","updated_at":"2026-03-09T23:04:47.937Z","avatar_url":"https://github.com/elipZis.png","language":"PHP","funding_links":["https://github.com/sponsors/elipZis"],"categories":[],"sub_categories":[],"readme":"# Simple key/value typed settings for your Laravel app\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/elipzis/laravel-simple-setting.svg?style=flat-square)](https://packagist.org/packages/elipzis/laravel-simple-setting)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/elipzis/laravel-simple-setting/run-tests.yml?branch=main)](https://github.com/elipzis/laravel-simple-setting/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/elipzis/laravel-simple-setting/php-cs-fixer.yml?branch=main)](https://github.com/elipzis/laravel-simple-setting/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/elipzis/laravel-simple-setting.svg?style=flat-square)](https://packagist.org/packages/elipzis/laravel-simple-setting)\n\nCreate, store and use\n\n* key/value settings,\n* typed from numbers over dates to array,\n* cached for quick access and\n* automatically synchronized to a configured disc as a static json export.\n\nCreate any setting you like\n\n```php\nSetting::create([\n    'key'   =\u003e 'setting.example.int',\n    'type'  =\u003e 'integer',\n    'value' =\u003e 336,\n]);\n```\n\nand get it back, anywhere in your app\n\n```php\n$example = Setting::getValue('setting.example.int');\n```\n\nor access the statically created e.g. `settings.json` export to reduce Webserver load!\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require elipzis/laravel-simple-setting\n```\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"simple-setting-config\"\n```\n\nThis is the contents of the published config file:\n\n```php\n    return [\n        'repository' =\u003e [\n            //The table name where to store the settings.\n            'table' =\u003e 'settings',\n            //The used cache configuration\n            'cache' =\u003e [\n                'prefix' =\u003e 'settings',\n                'ttl'    =\u003e 3600\n            ]\n        ],\n    \n        'routing' =\u003e [\n            //Should routes be available to access the settings?\n            'enabled'    =\u003e true,\n            //What path prefix to be used\n            'prefix'     =\u003e 'setting',\n            //Any middleware?\n            'middleware' =\u003e [],\n        ],\n    \n        'sync' =\u003e [\n            //Where to statically sync the settings to\n            'disc'     =\u003e env('FILESYSTEM_DRIVER', 'local'),\n            //The filename to write to\n            'filename' =\u003e 'settings.json',\n            //Whether to automatically (re-)sync the settings to the disc with every change\n            'auto'     =\u003e true\n        ]\n    ];\n```\n\nBefore you publish the migrations, publish the config, if you would like to alter e.g. the table name.\n\nYou can publish and run the migrations with:\n\n```bash\nphp artisan vendor:publish --tag=\"simple-setting-migrations\"\nphp artisan migrate\n```\n\n## Usage\n\n### Creation\n\nThe following types can be used:\n\n```php\nSetting::create([\n    'key'   =\u003e 'setting.example.int',\n    'type'  =\u003e 'integer',\n    'value' =\u003e 336,\n]);\n```\n\n```php\n$now = Carbon::now();\nSetting::create([\n    'key'   =\u003e 'setting.example.datetime',\n    'type'  =\u003e 'datetime', //or date\n    'value' =\u003e $now-\u003eaddWeeks(2),\n]);\n```\n\n```php\nSetting::create([\n    'key'   =\u003e 'setting.example.bool',\n    'type'  =\u003e 'boolean',\n    'value' =\u003e false\n]);\n```\n\n```php\nSetting::create([\n    'key'   =\u003e 'setting.example.array',\n    'type'  =\u003e 'array',\n    'value' =\u003e [\n        'exampleA' =\u003e 'A',\n        'exampleB' =\u003e 'B',\n        'exampleC' =\u003e 'C',\n    ]\n]);\n```\n\n```php\nSetting::create([\n    'key'   =\u003e 'setting.example.string',\n    'type'  =\u003e 'string',\n    'value' =\u003e '((x^0.5)/0.9)+10'\n]);\n```\n\n### Retrieval\n\nReturn the whole model\n\n```php\nSetting::get('test');\n```\n\nwhich would return something like\n\n```php\n{\"test\":{\"id\":1,\"key\":\"test\",\"value\":\"test\",\"type\":\"string\",\"created_at\":\"2021-12-25T10:18:07.000000Z\",\"updated_at\":\"2021-12-25T10:18:07.000000Z\"}}\n```\n\nkeyed by the `key`.\n\nIf you just need the value, call\n\n```php\nSetting::getValue('test');\n```\n\nwhich returns only the value, in this case `test`.\n\n### Static export\n\nEvery change/creation of a setting is automatically updating a statically exported file, by default `settings.json` on your default filesystem disc. This should ensure a reduced Webserver load for external access by e.g. your SPA frontend so that they just need to access a for example to S3 exported CDN-cached file, without \"hammering\" the Webserver every time.\n\n#### Command\n\nSettings can/will be (re-)synced to your disc for static access automatically, if configured. You can (re-)sync these by calling the command\n\n```php\nphp artisan setting:sync\n```\n\nAll settings will be exported to a json file to the configured disc.\n\n### Controller\n\nIf you have routing activated, you may access the settings via routes, e.g. `GET https://yourdomain.tld/setting/{setting}` to get a setting by key.\n\n*Note: Routes only return values and have no `setter` endpoint!*\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](.github/SECURITY.md) on how to report security vulnerabilities.\n\n## Credits\n\n- [elipZis GmbH](https://elipZis.com)\n- [NeA](https://github.com/nea)\n- [All Contributors](https://github.com/elipZis/laravel-simple-setting/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felipzis%2Flaravel-simple-setting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felipzis%2Flaravel-simple-setting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felipzis%2Flaravel-simple-setting/lists"}