{"id":15561099,"url":"https://github.com/thinhbuzz/laravel-setting","last_synced_at":"2026-04-21T05:31:03.790Z","repository":{"id":62498470,"uuid":"44968559","full_name":"thinhbuzz/laravel-setting","owner":"thinhbuzz","description":"Management settings for laravel 5 using json file.","archived":false,"fork":false,"pushed_at":"2017-07-11T13:33:40.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T06:33:22.375Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thinhbuzz.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":"2015-10-26T13:02:55.000Z","updated_at":"2017-01-03T03:22:38.000Z","dependencies_parsed_at":"2022-11-02T11:46:42.928Z","dependency_job_id":null,"html_url":"https://github.com/thinhbuzz/laravel-setting","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/thinhbuzz/laravel-setting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinhbuzz%2Flaravel-setting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinhbuzz%2Flaravel-setting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinhbuzz%2Flaravel-setting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinhbuzz%2Flaravel-setting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinhbuzz","download_url":"https://codeload.github.com/thinhbuzz/laravel-setting/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinhbuzz%2Flaravel-setting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32078695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"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":[],"created_at":"2024-10-02T16:05:27.854Z","updated_at":"2026-04-21T05:31:03.775Z","avatar_url":"https://github.com/thinhbuzz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Package changes config for laravel 5.*\n\n## Cài đặt\nMở file `composer.json` và thêm `require`:\n\n```json\n{\n    \"require\": {\n        \"buzz/laravel-setting\": \"1.*\"\n    }\n}\n```\n\nSau đó chạy lệnh ```composer update``` để cài đặt.\n\nhoặc chạy command sau để tự động thêm vào `composer.json` và cài đặt:\n\n```\ncomposer require buzz/laravel-setting\n```\n\n\nMở file `config/app.php` và thêm ServiceProvider.\n\n```\n'providers' =\u003e [\n    //.....\n    Illuminate\\Validation\\ValidationServiceProvider::class,\n    Illuminate\\View\\ViewServiceProvider::class,\n    //.....\n    \\Buzz\\LaravelSettingServiceProvider::class,\n],\n```\n\n\n### Cấu hình\n\nTạo file cấu hình ``config/setting.php`` bằng lệnh sau:\n\n~~~\nphp artisan vendor:publish --provider=\"Buzz\\LaravelSettingServiceProvider\"\n~~~\n\nhoặc\n\n~~~\nphp artisan vendor:publish\n~~~\n\n##### setting.php\n```\n\u003c?php\nreturn [\n    'path' =\u003e storage_path('settings.json'),//đường dẫn tới file `setting.json`, nên đặt ở `storage` hoặc `resources`\n    'auto_alias' =\u003e true,//tự động tạo thêm alias `Setting`\n    'auto_save' =\u003e true,//tự động save sau khi kết thúc request (sẽ không hoạt động nếu sử dụng `exit` hoặc `die`)\n    'force_save' =\u003e false,//bắt buộc gọi save dù không thực hiện thao tác add, set, remove\n    'system_cnf' =\u003e false,//get config của app nếu trong setting không tồn tại\n];\n```\n\n\n## Sử dụng\n\n#### Thay đổi alias\n\nMặc định package sẽ thêm alias `Setting` và bạn chỉ việc sử dụng alias này, nếu bạn muốn thay đổi alias thì sửa `'auto_alias'=\u003efalse` và thêm trong `aliases` của `config/app.php`\n\n```\n'aliases' =\u003e [\n    //.....\n    'Validator' =\u003e Illuminate\\Support\\Facades\\Validator::class,\n    'View'      =\u003e Illuminate\\Support\\Facades\\View::class,\n    //.....\n    'YourAlias'      =\u003e \\Buzz\\LaravelSettingFacade::class,\n],\n```\n\n#### Tắt tự động lưu\n\nMặc định package sẽ chỉ lưu khi kết thúc request và settings có thay đổi bất kì, nếu bạn muốn tắt chức năng này thì sửa `'auto_save' =\u003e true,` và sau đó sử dụng `Setting::save()` (hoặc `YourAlias::save()` nếu bạn đã đổi alias).\n***Lưu ý: tính năng tự động lưu sẽ không hoạt động nếu bạn dùng `exit` hoặc `die` function\n\n\n\n### Các hàm hỗ trợ\n\n```php\nSetting::clean();//xóa tất cả settings\nSetting::save($force = false);//Lưu tất cả các thay đổi\nSetting::all();//Lấy ra tất cả settings\nSetting::has($key);//kiểm tra sự tồn tại của setting theo key\nSetting::get($key, $default = false, $system = false);//lấy giá trị theo key\nSetting::setData($data);//ghi đè tất cả settings\nSetting::add($key, $value);//thêm mới một setting\nSetting::add([\n    ['name' =\u003e 'name1', 'value' =\u003e 'value1'],\n    ['name' =\u003e 'name2', 'value' =\u003e 'value2'],\n    ['name' =\u003e 'name3', 'value' =\u003e 'value3'],\n]);//thêm mới nhiều settings\nSetting::remove($key);//xóa một setting theo key\nSetting::remove([\n    'name1',\n    'name2',\n    'name3',\n]);//xóa nhiều settings theo key\nSetting::set($key, $default);//cập nhật giá trị mới cho setting theo key\nSetting::set([\n    ['name' =\u003e 'name1', 'value' =\u003e 'value1'],\n    ['name' =\u003e 'name2', 'value' =\u003e 'value2'],\n    ['name' =\u003e 'name3', 'value' =\u003e 'value3'],\n]);//cập nhật giá trị mới cho nhiều settings theo key\nSetting::sync();//thêm tất cả config của app vào Setting\nSetting::sync('mail');//thêm config của app vào Setting theo key\nSetting::sync([\n    'key1',\n    'key2',\n    'key3',\n]);//Thêm nhiều config của app vào Setting theo key\n```\n\n\u003e Package sử dụng các [array helpers](http://laravel.com/docs/5.1/helpers#arrays) của laravel, để biết cách sử dụng `$key` rõ hơn vui lòng đọc thêm tại [Laravel Helper Functions](http://laravel.com/docs/5.1/helpers#arrays).\n\n## Contribute\n\nhttps://github.com/thinhbuzz/laravel-setting/pulls","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinhbuzz%2Flaravel-setting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinhbuzz%2Flaravel-setting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinhbuzz%2Flaravel-setting/lists"}