upyun/sdk
Official PHP SDK for UPYUN cloud storage, offering simple APIs for uploading, downloading, deleting, and managing files, generating upload tokens, and integrating UPYUN storage and CDN services into Laravel or plain PHP applications.
Architecture fit. upyun/sdk is a thin, framework-agnostic PHP client for UPYUN (又拍云), a China-based object storage + CDN + media-processing platform. It is not a Laravel package: there is no service provider, no facade, no config publishing, and no Flysystem adapter. Architecturally that makes it a dependency you own and wrap, not one you install and forget. It maps cleanly onto a hexagonal "storage driver" boundary — a CloudStorage/ObjectStore contract in your domain layer with an UPYUN implementation behind it — but only if you build that boundary yourself. Teams that call Upyun\Upyun directly from controllers will find the coupling expensive to unwind later.
Integration feasibility. Composer-installable with PSR-4 autoloading, so wiring is straightforward: config file for bucket/operator/password/domain, a container binding (singleton or per-bucket factory), and optionally a facade for ergonomics. Multi-bucket and multi-tenant setups are feasible via multiple Config instances. The real friction is version constraints — verify the SDK's Guzzle and PHP requirements against your Laravel version before committing, since a dormant package's constraints can block a framework upgrade months later. A half-day proof of concept should resolve this.
Technical risk.
Key questions. Which UPYUN capabilities do we actually need — raw storage, CDN, on-the-fly image/video processing, or all three? Is a China-resident user base a hard requirement (if not, S3/OSS/GCS is the lower-risk default)? What is our supported PHP/Laravel matrix today and in 12 months? Do we need a Flysystem abstraction for portability? What is the contracted SLA and support channel, and who is our named escalation contact? Is there an exit path if the vendor relationship ends?
Stack fit. Use the SDK as the lowest layer only. Recommend: domain-level storage interface → Laravel Storage facade backed by a community Flysystem UPYUN adapter for the 90% of code that just reads/writes files → direct SDK calls only for UPYUN-specific features (signed upload tokens, image-processing URL parameters, CDN purge, async media jobs). This keeps most of the codebase provider-neutral and confines vendor knowledge to one or two classes.
Migration path. If assets already live on S3/本地磁盘/another provider: build the interface, stand up the UPYUN implementation alongside the existing one, dual-write new objects, backfill historical objects with a queued batch job, verify by checksum and sampled reads, then flip reads via config flag and retain the old driver as a rollback for one release cycle. If this is greenfield, skip the dual-write but still keep the interface.
Compatibility. Pin the SDK explicitly and add a composer.json conflict/constraint note. Run the full test suite on the target PHP 8.x minor; add a smoke test that exercises upload, stat, list, delete, and signed-token generation against a dedicated test bucket in CI (guarded by env, not run on every PR). Instrument the HTTP client with a Guzzle middleware for timing/logging so you get observability the SDK doesn't provide.
Sequencing.
Maintenance. Treat this as a vendored dependency: pin the version, expect no upstream fixes, and budget for a fork if PHP 8.4+ breaks it. The codebase is small enough that a fork is a day of work, not a quarter — but assign an owner so it isn't discovered during an incident.
Support. Vendor support runs on Chinese business hours via account manager, not a public issue tracker. Internal first-line support must be able to diagnose auth failures and CDN staleness without vendor help; write the runbook before launch.
Scaling. Throughput is bounded by PHP workers and per-request HTTP round trips to China-region endpoints. Push uploads to a queue with bounded concurrency; prefer direct-to-UPYUN signed uploads from the browser for large media so your app servers never proxy bytes. Watch egress costs — CDN is the point, but cache-hit ratio is the metric that determines the bill.
Failure modes to design for. Signature/credential expiry (401s that look like 403s), bucket or service misconfiguration after a console change, request timeouts on large files, silent CDN staleness after overwriting an object at the same key (requires explicit purge), partial failures in chunked/multipart uploads, and rate limiting under batch jobs. None of these are surfaced by the SDK beyond an exception — map them to distinct, alertable application errors.
Ramp-up. The SDK's own API is learnable in hours. The real cost is UPYUN's product model — service vs. bucket vs. operator vs. sub-account, custom domains and CNAMEs, token auth versus operator auth, and cache-control semantics. Budget 1–2 days for a mid-level engineer to be productive and roughly a week before they can operate it confidently in production. Chinese-only documentation raises this for non-Mandarin-reading teams; pair them with someone who can navigate the console.
How can I help you explore Laravel packages today?