{"id":28476620,"url":"https://github.com/armincms/option","last_synced_at":"2025-07-02T16:31:56.755Z","repository":{"id":62487640,"uuid":"226459492","full_name":"armincms/option","owner":"armincms","description":"A key-value storage for laravel","archived":false,"fork":false,"pushed_at":"2020-12-03T05:35:47.000Z","size":32,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T15:07:21.106Z","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/armincms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-12-07T05:13:10.000Z","updated_at":"2024-05-03T10:27:06.000Z","dependencies_parsed_at":"2022-11-02T11:00:52.906Z","dependency_job_id":null,"html_url":"https://github.com/armincms/option","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/armincms/option","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armincms%2Foption","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armincms%2Foption/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armincms%2Foption/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armincms%2Foption/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/armincms","download_url":"https://codeload.github.com/armincms/option/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/armincms%2Foption/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263175535,"owners_count":23425589,"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","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":"2025-06-07T15:07:20.949Z","updated_at":"2025-07-02T16:31:56.745Z","avatar_url":"https://github.com/armincms.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Option   \nA key-value storage for laravel \n\n##### Table of Contents   \n\n* [Introduction](#introduction)      \n* [Installation](#installation)      \n* [Configuration](#configuration)           \n* [Single Storing](#single-storing)          \n* [Mass Storing](#mass-storing)            \n* [Grouped Data](#grouped-data)           \n* [Retrieving](#retrieving)           \n* [Retrieving From Other Storage](#retrieving-from-other-storage)   \n* [Check For Existence](#check-for-existence)   \n\n\n\n## Introduction\nArmincms Option is a package for store `key-value`. with this package, you can store values by `key` and `tag` in the simplest way into multiple storages.\n\n## Installation\n\nTo get started with Armincms Option, first run:\n\n```\n    composer require armincms/option\n```\n\nThen publish configuration:\n\n```\n    php artisan vendor:publish --tag=armincms.option\n```\n\nThis command publishes `config` and `migration` file into the appropriate path.\n\n## Configuration\n\nThis package supports `file` and `database` storage for storing data.\nThe default storage is `file`. for change the storage type you have two way:\n\n* With `.env` file: `OPTION_DRIVER=database` \n* With `Config` respository: `Config::set('option.default', 'file')`\n \n**Attention 1:**\n\t*if you want use database storage you should run `php artisan migrate` in console.*\n\t\n**Attention 2:**\n\t*For access to `option-manager` by laravel container you can use `app('armincms.option')`*\n\t\n**Attention 3:**\n\t*For simple coding: you can use helper `option()` insteadof `app('armincms.option')`*\n\n\n### Single Storing\n\nThere exists two way for storing single data:\n\n* first:\n\t`option()-\u003eput(key, value)`\n\n* second: \n\t`option()-\u003ekey = value` \n\t\n\t\n\n### Mass Storing \n\nFor mass storing data use the followings method: \n\n\toption()-\u003eputMany([\n\t\tkey1 =\u003e value1,\n\t\tkey2 =\u003e value2,\n\t])  \n\t\n\t\n\n### Grouped Data \n\nFor grouping many option, can pass `tag` parameter when storing a data: \n\n\tapp('armincms.option')-\u003eput(key, value, tag)\n\nAlso; it's possible to attach a tag into data when mass storing:\n\n\tapp('armincms.option')-\u003eputMany([\n\t\tkey1 =\u003e value1,\n\t\tkey2 =\u003e value2,\n\t], tag)\n\n\n\n### Retrieving\n\nThere exist many ways to retrieve your data.you can retrieve your data, `single` or `multiple`.\n\n*single retrieving:*\n\nTo retrieve an option, you can use `option()-\u003ekey`. but if you need `default` value for missed values;  you can use `option(key, default)` or `option()-\u003eget(key, default)` . \n\n*multiple retrieving:*\n\nAlso, retrieving multiple options is not difficult. you can retrieve many values by its keys with the `many` method; like  `option()-\u003emany(keys)`.\nIf you need default value for missed values; you can pass an associative array of `keys` and `default values`; like following:\n\n```\n\toption()-\u003emany([\n\t\tkey1 =\u003e key1-default, \n\t\tkey2 =\u003e key2-default,\n\t\tkey3,\n\t\tkey4,\n\t\tkey5 =\u003e key5-default\n\t])\n```\n\nAnd you can retrieve `tagged` values with `option()-\u003etag(tag)`. \n\n\n\n### Retrieving From Other Storage\n\nFor store an option into `none default` driver with assumption that default \ndriver is `database`; follow this:\n\n\tapp('armincms.option')-\u003estore('file')-\u003eput(key, value, tag)\n\tapp('armincms.option')-\u003estore('file')-\u003emany([key1, key2], tag)\n\nFor retrieve you can use this: \n\n\tapp('armincms.option')-\u003estore('file')-\u003eget(key, default)\n\tapp('armincms.option')-\u003estore('file')-\u003etag(tag) \n\tapp('armincms.option')-\u003estore('file')-\u003emany(keys)  \n\n\n### Check For Existence\nIf you want to check for existance of an option ; you can use helper `option_exists(key)` or `option()-\u003ehas(key)`.\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmincms%2Foption","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farmincms%2Foption","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmincms%2Foption/lists"}