-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 473b520
Showing
13 changed files
with
901 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Copyright 2018 Tyler Stuyfzand | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
SeaweedFS PHP Client | ||
==================== | ||
|
||
A basic but functional PHP client for [seaweedfs](https://github.com/chrislusf/seaweedfs) | ||
|
||
Usage | ||
----- | ||
|
||
Create an instance of the `SeaweedFS\SeaweedFS` class, optionally specifying `scheme` and `cache` for http/https and Volume lookup caching. | ||
|
||
Example | ||
------- | ||
|
||
```php | ||
<?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; | ||
``` | ||
|
||
Other packages | ||
-------------- | ||
|
||
* Flysystem-SeaweedFS | ||
* Laravel-SeaweedFS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "tystuyfzand/seaweedfs-client", | ||
"description": "A SeaweedFS implementation for PHP based on Guzzle", | ||
"type": "library", | ||
"license": "ISC", | ||
"authors": [ | ||
{ | ||
"name": "Tyler Stuyfzand", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"guzzlehttp/guzzle": "^6.3" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"SeaweedFS\\": "src/" | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace SeaweedFS\Cache; | ||
|
||
/** | ||
* A base Cache interface that can be implemented as many different caches. | ||
* | ||
* @package SeaweedFS\Cache | ||
*/ | ||
interface CacheInterface { | ||
/** | ||
* Check if the cache implementation contains the specified key. | ||
* | ||
* @param $key | ||
* @return bool | ||
*/ | ||
public function has($key); | ||
|
||
/** | ||
* Get the specified key from the cache implementation. | ||
* | ||
* @param $key | ||
* @param mixed $default | ||
* @return mixed | ||
*/ | ||
public function get($key, $default = null); | ||
|
||
/** | ||
* Set the value in the cache implementation. | ||
* | ||
* @param $key | ||
* @param $value | ||
* @param int $minutes | ||
* @return mixed | ||
*/ | ||
public function put($key, $value, $minutes = 0); | ||
|
||
/** | ||
* Remove a value from the cache. | ||
* | ||
* @param $key | ||
* @return mixed | ||
*/ | ||
public function remove($key); | ||
} |
Oops, something went wrong.