tencentcloud/common
tencentcloud/common provides shared foundation code for Tencent Cloud PHP SDK packages, including request signing, HTTP transport, credential handling, and common exceptions. Add it when integrating Tencent Cloud APIs or building service-specific clients in PHP.
What this package actually is. tencentcloud/common is not an application-facing package — it is the shared runtime core for the Tencent Cloud PHP SDK family. It ships the base AbstractClient, the Credential object (SecretId/SecretKey/token), ClientProfile/HttpProfile transport configuration, the TC3-HMAC-SHA256 (and legacy HmacSHA1/MD5) request signers, and TencentCloudSDKException. Every product SDK (tencentcloud/cvm, tencentcloud/ocr, tencentcloud/sms, etc.) depends on it. A Laravel team never "uses" it directly; they use it indirectly through a product SDK, and the TPM decision is really about whether to standardize on the Tencent SDK family at all and how much wrapper to build.
Architecture fit. Poor fit as a framework citizen, acceptable as a transport library. There is no ServiceProvider, no facade, no publishable config, no config-repository awareness. Configuration is imperative: you construct Credential and HttpProfile objects per client instance. In a Laravel app this means every consumer either hand-rolls client construction or you build a container-bound factory and a config/tencentcloud.php. That wrapper is unavoidable and is the bulk of the integration work. Credentials are plain strings with no built-in chain (no env-var, instance-profile, or metadata-service provider), and no automatic STS token refresh — rotation logic is yours.
Integration feasibility. Straightforward and low-magic. composer require tencentcloud/common plus the specific product package, wire a singleton factory, done. Watch the dependency footprint: recent 3.x releases pull in Guzzle (older 2.x used raw cURL), so you inherit Guzzle's PSR-7/PSR-18 surface and its version constraints — pin and verify against your locked Laravel/Symfony versions. Apache-2.0 is commercially clean and includes a patent grant.
Technical risk.
common as a pinned transitive dependency and test upgrades deliberately; a product SDK bump can drag common across a major.HttpProfile, so unit-testing against the SDK is painful. Mock at your own service boundary, not at the SDK..env, manual rotation, no refresh.Key questions for the vendor/team. Which product SDKs and regions are in scope? Do we need STS temporary credentials (and therefore a refresh loop)? What per-API QPS quotas apply to our account tier? Is common pinned independently of product SDKs in our lockfile? Do we have a Chinese-reading engineer for the docs?
Stack fit. Treat it as infrastructure, not as a package to "adopt." The clean Laravel shape is: config/tencentcloud.php (secret id/key/region/endpoint, sourced from env or a secrets manager), a TencentCloudServiceProvider binding a ClientFactory singleton, and one thin domain service per product (SmsSender, OcrClient) that owns its SDK client. Controllers and jobs depend on your interface, never on TencentCloud\Common\*. This keeps the SDK swappable and testable.
Migration path. No migration — greenfield dependency. The only "migration" is from ad-hoc new Credential(...) calls scattered across the codebase into the factory; enforce that from day one so you never have to consolidate later.
Compatibility. Verify PHP 8.2/8.3 support in the exact locked version (older lines target PHP 5.6/7.x), confirm Guzzle 7 alignment with Laravel's HTTP client usage, and check for global-state hazards — ClientProfile/HttpProfile instances are mutable and should be treated as per-client, not shared singletons, to avoid timeout bleed between services. Ensure ext-curl and ext-json are in your base image.
Sequencing.
.env.example entries, secrets manager wiring, and a documented rotation runbook.TencentCloudSDKException → domain-exception mapper registered in the exception handler.RequestLimitExceeded, InternalError), never on validation errors; add idempotency tokens where the API supports them.Maintenance. Low steady-state cost — the SDK is thin and Tencent maintains it — but the upgrade path is opaque: sparse changelogs, Chinese-first documentation, and majors that move the HTTP layer. Budget a deliberate quarterly review of pinned versions rather than relying on Dependabot auto-merges.
Support. Single-vendor governance (Tencent). Community support is thin in English; expect to lean on official docs and ticketing. Internally, the wrapper layer is yours to own, so assign a named owner — otherwise the credential and retry logic rots silently.
Scaling. Scaling is bounded by PHP worker concurrency and Tencent's per-API QPS quotas, not by the library. Synchronous calls inside request handlers will saturate FPM under load; push throughput-sensitive workloads to queues with bounded worker pools. Add client-side throttling or a token-bucket per API so a traffic spike degrades gracefully instead of burning the quota and failing everything. Multi-region endpoints are per-client configuration, so a region failover strategy means constructing clients per region, not reusing one.
Failure modes to design for. Clock skew breaking TC3 signatures (keep NTP tight, surface AuthFailure.SignatureExpire distinctly); expired STS tokens if you adopt temporary credentials; region/endpoint mismatch; throttling under burst; cURL timeouts hanging workers when HttpProfile defaults are too generous; and unhandled TencentCloudSDKException leaking vendor error strings into user-facing responses. Each needs an explicit handling decision, not a catch-all.
Ramp-up. Roughly one to two engineer-days for a competent PHP developer to ship the wrapper plus first integration, assuming the spike lands. The friction is not the code — it's the documentation language gap, the absence of Laravel-native examples, and the need to invent credential rotation and test doubles from scratch. The low star count is an accurate proxy for "no community scaffolding," not for code quality.
How can I help you explore Laravel packages today?