承接 brannonh/snapi-file 相关项目开发

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

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

brannonh/snapi-file

Composer 安装命令:

composer require brannonh/snapi-file

包简介

A simple PHP REST API to access data stored in the filesystem

README 文档

README

A simple PHP REST API to access data stored in the filesystem

Purpose

This is an extremely lightweight REST API that utilizes (JSON) files as data stores. Just name your stores and point them to a file, and snAPI-File will handle the rest.

Support

If you run into any problems, please let us know by opening a new issue.

Store File

You must point snAPI-File to the stores you want to use. By default, snAPI-File loads those from a stores.json file, however you may change that through the constructor (see below).

The store file should be in the following format.

{
  "store1": "store1.json",
  "store2": "store2.json"
}

The store being used is sent in each request. Only stores referenced in the store file are supported. Any other referenced store will result in an HTTP 404 error.

Usage

Setup

Setting up the API is simple. Just create your store file and add the following lines to your PHP file.

use \SnapiFile\Api;

$api = new Api();
$api->go();

That's it. snAPI-File will handle the requests from there.

API

__construct($storeFile)

Parameters
Parameter Type Required Default Notes
$storeFile string 'stores.json' The default file is created in the same directory as your PHP file.
Returns
Type Notes
Api The Api object

🎩

go()

Parameters
Parameter Type Required Default Notes
void
Returns
Type Notes
void

🎩

Client Requests

Requests to snAPI-File must be either GET or POST and include a specific set of parameters.

Parameter Required Notes
store ✔️ The store to use
action ✔️ The action to perform (i.e., create, retrieve, update, delete)
key The key in the store to affect

Only required for create, update, and delete actions. Use with retrieve to get a specific record from the store. Omit from retrieve to get all records from the store.
value ✔️ The value to use to affect key

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固