Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unclexo/filestorage
:rocket: A blazing fast and light-weight flat-file storage designed for storing array data to keys
https://github.com/unclexo/filestorage
associative-array-storage file-storage flat-file-storage storage storage-container storage-manager
Last synced: 11 days ago
JSON representation
:rocket: A blazing fast and light-weight flat-file storage designed for storing array data to keys
- Host: GitHub
- URL: https://github.com/unclexo/filestorage
- Owner: unclexo
- License: mit
- Created: 2020-05-26T08:13:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-03T14:49:48.000Z (over 4 years ago)
- Last Synced: 2024-08-02T05:22:54.192Z (3 months ago)
- Topics: associative-array-storage, file-storage, flat-file-storage, storage, storage-container, storage-manager
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazingly-fast - filestorage - :rocket: A blazing fast and light-weight flat-file storage designed for storing array data to keys (PHP)
README
# filestorage
A blazing fast and light-weight flat-file storage designed for storing array data to keys.[![PHP Version](https://img.shields.io/badge/php-%3E%3D7.3-informational)](https://php.net/)
[![PHPStan](https://img.shields.io/badge/PHPStan-passing-success)](https://phpstan.org/)
[![PHP Unittest](https://img.shields.io/badge/tests-15-blue)](https://packagist.org/packages/phpunit/phpunit)
[![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Funclexo%2Ffilestorage)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Funclexo%2Ffilestorage)## Sample Array Data
```php
[
'clientId' => 'facebookClientId',
'clientSecret' => 'facebookClientSecret',
'redirectUri' => 'facebookRedirectUri',
],
'twitter' => [
'clientId' => 'twitterClientId',
'clientSecret' => 'twitterClientSecret',
'redirectUri' => 'twitterRedirectUri',
],
];
```Alternatively, you can store (key => value) pairs too.
```php
'value',
'more_key' => ['key' => 'value'],
];
```## Download using composer
```bash
composer require unclexo/filestorage
```## Creating a store
`filestorage` stores array data into a file. You can create a file-storage using `Storage::create($data, $location)`.
Keep in mind `$location` must be existed and writable.```php
[
'clientId' => 'facebookClientId',
'clientSecret' => 'facebookClientSecret',
'redirectUri' => 'facebookRedirectUri',
],
'twitter' => [
'clientId' => 'twitterClientId',
'clientSecret' => 'twitterClientSecret',
'redirectUri' => 'twitterRedirectUri',
],
];/** File must be writable */
$location = '/home/username/data/storage.txt';Storage::create($data, $location);
```## Using the store
Once you've created a store, you can use the store through the whole application. Just create an instance of the store specifying the file location and use wherever you need it.```php
'facebookClientId',
'clientSecret' => 'facebookClientSecret',
'redirectUri => 'facebookRedirectUri',
]
```#### To set data
```php