summergeorge/ali-oss-storage
Aliyun OSS storage adapter for Laravel that plugs Alibaba Cloud Object Storage Service into Laravel's filesystem via Flysystem. Configure your access keys, bucket and endpoint, then read, write and delete files using the familiar Storage facade.
The package is a thin Flysystem adapter that teaches Laravel's Storage facade to talk to Aliyun OSS. You don't interact with it directly — you configure a disk and forget it exists.
composer require summergeorge/ali-oss-storage.Summergeorge\AliyunOssStorage\AliyunOssStorageServiceProvider::class to config/app.php. Verify the class name against the README — this fork may namespace it slightly differently from jacobcyl/ali-oss-storage.config/filesystems.php:'oss' => [
'driver' => 'oss',
'access_key_id' => env('ALIYUN_ACCESS_KEY_ID'),
'access_key_secret' => env('ALIYUN_ACCESS_KEY_SECRET'),
'bucket' => env('ALIYUN_OSS_BUCKET'),
'endpoint' => env('ALIYUN_OSS_ENDPOINT'), // oss-cn-hangzhou.aliyuncs.com
'domain' => env('ALIYUN_OSS_DOMAIN'), // optional CNAME / CDN
'is_cname' => false,
],
The first real use case is almost always "upload an avatar and return a URL":
$path = Storage::disk('oss')->putFileAs('avatars', $request->file('avatar'), "{$user->id}.jpg");
$url = Storage::disk('oss')->url($path);
Look at the README, AliyunOssStorageServiceProvider, and the adapter class first — the provider is where the oss driver is registered with Storage::extend(), so it tells you exactly which config keys are read.
oss at a bucket per env (myapp-prod, myapp-staging) via FILESYSTEM_DISK and env vars. Never share a bucket across staging and prod — OSS has no "list only my prefix" isolation, and it's easy to delete staging data from a prod deploy.Storage::disk('oss') everywhere, wrap uploads in a small service (MediaStorage::storeUploadedFile()) so you can swap to S3 or local in tests without touching controllers.Storage::disk('oss')->get() / ->put(). This keeps the upload request fast and avoids the adapter's lack of native multipart streaming.getAdapter() if the package doesn't expose a temporaryUrl() helper; the Aliyun SDK call is signUrl($bucket, $object, $timeout).FILESYSTEM_DISK=local (or Storage::fake('oss') in a test setup that overrides the disk) so CI doesn't need real credentials. Integration tests against a real bucket belong behind an env flag.InvalidBucketName / connection errors. Don't include https:// in endpoint on most forks; put the scheme handling in the adapter's domain/ssl config instead. Try oss-cn-hangzhou.aliyuncs.com first, then https://oss-cn-hangzhou.aliyuncs.com if the first fails — this fork's behavior differs from the upstream jacobcyl package.url() output depends entirely on is_cname and domain. With neither set, you get a signed public URL of the form https://{bucket}.{endpoint}/{path}. Set domain and is_cname=true when serving through a CDN, otherwise you'll get CDN-looking URLs that actually resolve to the bucket. Cache-bust on CDN invalidation, not on the code.oss-cn-hangzhou-internal.aliyuncs.com for free traffic; from outside use the public endpoint. Mixing them silently doubles your bill.ACL is per-object, not per-bucket from the driver's perspective. If the adapter defaults to private, url() will still return a working URL for a few seconds, then 403 — use signed URLs (temporaryUrl) or explicitly set public-read in the put options array.apist/aliyun-oss or a Flysystem-3-compatible fork — or expect to patch the adapter yourself.multipartUpload directly. This is a real ceiling for video pipelines.exists() vs. has() behave differently on OSS because OSS has no cheap HEAD; both round-trip to the API. Don't call them in a loop — list the directory once with files()/allFiles() and check membership in memory.Storage::extend('oss', ...); subclass the adapter and re-register under a new driver name if you need custom path prefixing or per-tenant buckets. That's cleaner than forking the package for a 10-line change.Overall: usable for simple "upload, store, serve via CDN URL" workloads on Laravel 8 and below. Treat it as a stalled dependency — with 39 stars, zero dependents, and no release since 2021, budget time to vendor a patched copy rather than expecting upstream fixes.
How can I help you explore Laravel packages today?