PHP code example of lonelywalkersource / flysystem-oss
1. Go to this page and download the library: Download lonelywalkersource/flysystem-oss library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lonelywalkersource / flysystem-oss example snippets
use Lonelywalksource\Flysystem\Oss\Config\OssConfig;
use Lonelywalksource\Flysystem\Oss\OssAdapter;
$config = OssConfig::fromArray([
// ── Required ─────────────────────────────────────────
// Alibaba Cloud AccessKey ID (alias: 'key')
'access_key' => 'your-access-key',
// Alibaba Cloud AccessKey Secret (alias: 'secret')
'secret_key' => 'your-secret-key',
// OSS endpoint, e.g. oss-cn-hangzhou.aliyuncs.com
'endpoint' => 'oss-cn-hangzhou.aliyuncs.com',
// Bucket name
'bucket' => 'your-bucket',
// ── Optional ─────────────────────────────────────────
// Region (e.g. cn-hangzhou) — ───────
// Whether to throw exceptions. Default: true
'throw' => true,
// ── OssClient Extra Options ──────────────────────────
// Any key not listed above is passed directly to the OssClient constructor.
// Valid OssClient options
$adapter = new OssAdapter($config);
$adapter->write('path/to/file.txt', 'Hello OSS', new \League\Flysystem\Config());
$client = new \OSS\OssClient([...]);
$adapter = new OssAdapter($config, $client);
use Lonelywalksource\Flysystem\Oss\Signer\CallbackSigner;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
$signer = new CallbackSigner($httpClient, $requestFactory);
$result = $signer->verify($authorization, $pubKeyUrl, $path, $body);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.