定制 lefuturiste/localstorage 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lefuturiste/localstorage

Composer 安装命令:

composer require lefuturiste/localstorage

包简介

Key/value JSON localstorage like redis

README 文档

README

Build Status

This library can be useful if you need localstorage/cache key:value on disk for your PHP application.

Installation

You can easily install the localstorage lib using composer:

composer require lefuturiste/localstorage

Usage

All methods are on the Lefuturiste\LocalStorage\LocalStorage class

This is a small and quick example of this lib.

<?php
require 'vendor/autoload.php';

// simple key value store
$localStorage = new Lefuturiste\LocalStorage\LocalStorage();
$localStorage->set('my-key', 'my-value'); // set a value
$localStorage->set('my-key', ['object' => ['is_complex' => true, 'number' => 1]]); // all values are json encoded so you can save array with string, int, float, boolean and null values
$localStorage->save(); // this will write the file on disk, don't forget to call it when you mutate the state!
$localStorage->get('my-key'); // retrieve the value (this will decode the JSON)
$localStorage->has('my-key'); // will return true
$localStorage->has('unknown-key'); // will return false
$localStorage->del('my-key'); // yes it does what you think it will do
$localStorage->clear(); // you can remove all the keys using the clear() method
$localStorage->unlinkStorage(); // you can complety remove the .json file on the disk

// duration management
// by default all the keys are saved with the date of the creating, so you can if you want, delete all the keys olden than a specified duration.
$localStorage->deleteOlderThan(\Carbon\CarbonInterval::seconds(10));

Tests

All the tests are in the test folder

vendor/bin/phpunit test

统计信息

  • 总下载量: 260
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固