aliyuncs/oss-sdk-php
Alibaba Cloud OSS SDK for PHP lets you upload, download, and manage any files on Alibaba Cloud Object Storage from PHP 5.3+ applications via Composer, requiring the cURL extension.
restoreObject, getBucketStat, and traffic-limit parameters. That is enough to run a real cost model — hot vs. cold storage, retrieval costs, egress — without waiting for an infra ticket.response-* overrides), append object, uploading from a file handle, and symlink support cover the mechanics of direct-to-cloud uploads, resumable uploads, and time-limited share links. These are the primitives behind "upload big files from mobile," "share a private file with a customer," and "let the browser talk to storage instead of our app servers."Storage::disk('oss') filesystem driver in the repo. So the real decision is three-way: (a) adopt the SDK plus in-house Laravel glue, (b) adopt the SDK plus a community Laravel OSS adapter, or (c) skip it entirely by pointing Laravel's native S3 driver at an S3-compatible endpoint. Budget this explicitly — it is one to three sprints of integration, testing, and operational polish (credential handling, retries, error mapping, local test doubles), not a composer require.Adopt when:
Look elsewhere when:
~2.x is safe today, but plan for a V2 migration and do not let V1 idioms leak into dozens of call sites — wrap it.Decision gate: I would not greenlight this on the SDK's merits alone. I would greenlight it on the China strategy and treat the SDK as a solved, low-risk component of that bet.
To executives (one paragraph): If we decide to serve users in mainland China, storage is one of the few pieces we do not have to invent. Alibaba's official PHP SDK is free (MIT), maintained, and already covers the enterprise checklist — encryption, versioning, immutable retention for compliance, lifecycle tiering to cut storage cost, and direct browser uploads. Adopting it costs us roughly one to three sprints of integration work plus ongoing ownership of a thin wrapper. The strategic caveat is that it only pays off if we commit to Alibaba Cloud; without a China requirement, our existing S3-compatible setup is cheaper and simpler, and I would recommend we not take this on.
To engineering: This is a raw vendor SDK, not a Laravel package — no service provider, no filesystem driver, no config publishing. You will write the adapter: credential sourcing from env/secret manager, an OssClient singleton, a Storage::disk('oss') driver or Flysystem adapter, retry/timeout policy, and error mapping into our existing exception handling. Two things to get right up front: (1) wrap, don't sprinkle — keep all SDK calls behind one internal storage interface so the upcoming SDK V2 rewrite (already in beta, with different auth/retry/transfer semantics) is a swap, not a refactor; (2) pin ~2.x and treat V1 idioms as temporary. It is cURL-based and PHP 5.3+ lineage, so validate against our runtime — Swoole in particular has a history of edge cases. Add a bucket-backed integration test suite and a local fake so CI does not depend on cloud credentials.
To security/compliance: Bucket-level WORM retention, encryption, versioning, bucket policy, ACLs, and request signing (including Signature V4 and a credentials-provider abstraction) are all supported out of the box. Access keys must not live in code — use the environment-variable or custom credentials provider rather than hardcoded AccessKeyId/AccessKeySecret as shown in the README sample.
Ask: Approve a short spike (2–3 days) to validate the wrapper approach against our Laravel and PHP versions and confirm the China requirement is real. That spike either de-risks the integration or kills the initiative cheaply.
How can I help you explore Laravel packages today?