tystuyfzand / seaweedfs-client
基于Guzzle的PHP实现SeaweedFS
v1.0.7
2022-04-02 09:05 UTC
Requires
- guzzlehttp/guzzle: ^6.0|^7.0
Suggests
- ext-memcached: Enables caching for volumes and metadata using memcached.
- predis/predis: Enables caching for volumes and metadata using redis.
This package is auto-updated.
Last update: 2024-09-19 23:26:49 UTC
README
一个基本但功能齐全的seaweedfs PHP客户端
用法
创建一个SeaweedFS\SeaweedFS
类的实例,可选地指定http/https的scheme
和Volume查找缓存的cache
。
示例
<?php $cache = new \SeaweedFS\Cache\FileCache('./cache'); $client = new SeaweedFS\SeaweedFS('127.0.0.1:9333', 'http', $cache); // Upload a file and get the returned object (SeaweedFS\Models\File) $file = $client->upload('test1234', 'test.txt'); // Update a file $client->upload('Testing1234', 'test.txt', $file); // Retrieve the file contents $stream = $client->get($file->fid); echo stream_get_contents($stream) . PHP_EOL; // Delete a file $client->delete($file->fid); // Get a file's URL echo "URL: " . $file->getFileUrl() . PHP_EOL; // URLs can also be retrieved manually $volume = $client->lookup($file->fid); echo "URL (manual): " . $client->buildVolumeUrl($volume->getPublicUrl(), $file->fid) . PHP_EOL;
其他包
- Flysystem-SeaweedFS
- Laravel-SeaweedFS