承接 stolfam/data-storage-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

stolfam/data-storage-php

最新稳定版本:1.0.5

Composer 安装命令:

composer require stolfam/data-storage-php

包简介

Super simple interface for data storage written in PHP.

README 文档

README

Install

composer require stolfam/data-storage-php

Use

You can use existing implementations or implement your own logic of save/load by implementing interface IDataStorage.

Example

// you can use existing implementation or implement your own logic of save/load
$dataStorage = new CookiesStorage();
$serializableData = ...

// set data with protection to overwriting (example 1)
if($dataStorage->save("key", $serializableData, false)) {
    // successfully saved
} else {
    // "key" exists or error on save
}

// set data with overwritting enabled (example 2)
if($dataStorage->save("key", $serializableData)) {
    // successfully saved
} else {
    // error on save
}

// get data (example 1)
if($dataStorage->exists("key")) {
    // we are 100% sure that data exists
    $data = $dataStorage->load("key");
}

// get data (example 2)
$data = $dataStorage->load("key");
if($data != null) {
    // we are 100% sure that data exists
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-12