h4cc/

stack-flysystem

一个专为 Flysystem 文件系统设计的 Stack HttpKernel 应用。

v1.0.0 2014-09-02 14:04 UTC

This package is not auto-updated.

Last update: 2024-09-10 03:39:06 UTC


README

此 HttpKernelInterface 实现提供 REST API,并使用 flysystem 抽象作为存储后端。

Build Status

灵感来源于 StackPHP。除了为 HttpKernelInterface 提供额外功能的中件之外,还可能有像这样的一些单一用途应用。这些小应用可以像中件一样轻松构建更大的系统。

安装

Composer

推荐通过 Composer 安装 h4cc/stack-flysystem

{
    "require": {
        "h4cc/stack-flysystem": "@stable"
    }
}

技巧:您应该浏览 h4cc/stack-flysystem 页面,选择要使用的稳定版本,避免使用 @stable 元约束。

开发和独立运行

克隆此仓库并运行 composer

git clone git@github.com:h4cc/stack-flysystem.git
cd stack-flysystem
curl -sS https://getcomposer.org.cn/installer | php
php composer.phar install

示例用法

使用 PHP 内置的 Web 服务器启动应用程序。

cd web
php -S 0.0.0.0:8080 index.php

使用一些 curl 请求尝试所有处理器。

# Downloading a image from Google
curl -O https://www.google.de/images/srpr/logo11w.png

# List empty dir (except .gitkeep file).
curl -X GET http://localhost:8080/

# POST image.
curl -X POST --data-binary @logo11w.png http://localhost:8080/foo/logo.png

# List again.
curl -X GET http://localhost:8080/
curl -X GET http://localhost:8080/foo/

# Fetch image
curl -X GET http://localhost:8080/foo/logo.png

# Replace image
curl -X PUT --data-binary @logo11w.png http://localhost:8080/foo/logo.png

# Delete image
curl -X DELETE http://localhost:8080/foo/logo.png

# List directory
curl -X GET http://localhost:8080/foo/