iidestiny/flysystem-oss
Flysystem adapter for Alibaba Cloud OSS (Aliyun Object Storage Service). Integrate OSS storage with Laravel and PHP apps using Flysystem, enabling file uploads, reads, deletes, and URL generation through a familiar filesystem API.
Architecture fit. This is a thin port/adapter implementation: it connects league/flysystem (the filesystem abstraction Laravel's Storage facade is built on) to Alibaba Cloud OSS. Architecturally it lives at the infrastructure edge — application code continues to depend on Illuminate\Contracts\Filesystem\Filesystem, and only configuration changes. That is the right shape for a TPM to approve, because the blast radius of replacing it later is a config swap rather than a refactor.
It fits well when:
Storage::disk() and you need OSS for China-region latency, data residency, or cost.It does not fit when the product genuinely needs OSS-specific capabilities below the Flysystem line: x-oss-process image transforms, storage-class transitions to IA/Archive, versioning, inventory, Select, or KMS/CMK encryption. Those require the official aliyuncs/oss-sdk-php and a bespoke abstraction, not this package.
Integration feasibility. High for the happy path. Composer-installable; the v3 line targets Flysystem 3 (Laravel 9+). For Laravel wiring, the same author publishes a sibling service-provider package that registers the oss driver; alternatively you register a custom disk via Storage::extend() in a service provider — roughly 30 lines, and often the lower-risk choice because it removes an unmaintained dependency from the tree. Configuration surface is small: key, secret, bucket, endpoint, isCName, SSL, prefix. Budget hours to a day for a working disk, and several days for production hardening (IAM/STS credentials, presigned URLs, contract tests, parity checks).
Technical risk.
config/filesystems.php. Production should use a RAM role or STS temporary credentials. Verify whether a security-token parameter is supported; if not, you must implement credential refresh yourself and pass short-lived credentials into the disk config.visibility/ACL mapping (private vs public-read), temporaryUrl, mimeType, lastModified, directoryExists, server-side move/copy, and throwing the correct UnableTo* exceptions. Each gap surfaces as a broken framework feature — asset URL generation, backup jobs, queued deletes, cache invalidation.writeStream/readStream are genuinely streamed and that multipart thresholds are configurable. A buffering adapter will OOM on large uploads and only reveal itself under production load.prefix/root handling and key normalization (leading slashes, URL encoding, unicode) are a recurring source of orphaned and overwritten objects.Key questions for the maintainer/vendor.
temporaryUrl implemented, and does it respect custom domains / CNAME endpoints?SecurityToken and RAM-role credentials, or only static AccessKey/Secret?Stack fit. Composer-based, PHP with cURL. Fit is conditional on Flysystem major version alignment: this adapter's v3 line is required for Laravel 9+, and an older pinned tag will strand you on an unsupported framework. Keep all application code on Storage/Illuminate\Contracts\Filesystem\Filesystem; any direct OSS SDK call inside domain logic destroys the swap-out option that justifies adopting the adapter at all.
Migration path.
Compatibility checks before committing.
Storage::extend() is sufficient (prefer the latter unless the former is actively maintained).Sequencing.
Maintenance. The code surface is small — a handful of classes — so maintenance cost is dominated by dependency hygiene rather than by the adapter itself. Pin exact versions, watch upstream releases, and review the transitive OSS SDK. Assume you may need to vendor a fork; that is realistic for a mid-level PHP engineer precisely because the package is thin. Keep an internal StoragePort interface above Laravel's contract so an eventual rip-and-replace is configuration, not surgery.
Support. Community-only via GitHub issues, likely Chinese-language-first. There is no vendor SLA and no guaranteed response. For any Tier-1 revenue path, assign a named internal owner for the integration and its tests, and make the escalation boundary explicit for on-call: adapter defects are yours, OSS service defects are Alibaba Cloud's.
Scaling. OSS scales horizontally; the adapter is not the throughput bottleneck. The bottlenecks are on the PHP side: request concurrency, connection reuse, timeout tuning, and memory behavior on large files. For user-generated or multi-GB content, route uploads as presigned direct-to-OSS transfers rather than proxying bytes through PHP. Co-locate compute and bucket region and use the internal endpoint, because cross-region egress is the dominant cost line at volume.
Failure modes and mitigations.
Ramp-up. Low for Laravel developers: anyone comfortable with Storage::disk is productive within an hour on the happy path. Moderate for OSS depth — ACLs, storage class, lifecycle rules, versioning, presigned URLs — and for whoever debugs the second-order failures when a framework feature (backups, asset URLs, queued deletes) quietly stops working. Ship a one-page runbook covering key rotation, how to smoke-test a disk, where the disk is configured, and the fork procedure. Overall: a reasonable, low-ceremony component for a China-region Laravel workload, contingent on pinning, contract testing, and accepting single-maintainer dependency risk.
How can I help you explore Laravel packages today?