james.xue/laravel-ali-green
A Laravel wrapper for Alibaba Cloud Green (Ali Green) adding automated content moderation. Scan text, images, and media for risky or prohibited content through a clean API with facade support, so compliance checks on user-generated content are simple without touching the raw SDK.
Architecture fit. This is a thin Laravel adapter, not an engine: a ServiceProvider, facade, and publishable config that wrap Alibaba Cloud's Green (内容安全) content-moderation API. All detection — text anti-spam/keyword, image porn/terrorism/ads/QR-code, video pornography and political-violence categories — happens server-side at Aliyun. The package's only value is ergonomics (idiomatic Laravel config, facades, exception handling), so it is easily replicated and must be judged on wrapper quality, not capability.
Integration feasibility. Mechanically low-friction: composer require, publish config, add AccessKey ID/Secret to .env, call the facade. The real integration cost sits outside the code — Aliyun account provisioning, real-name verification, RAM least-privilege sub-account, region selection, and endpoint egress. Budget that as the dominant task.
Technical risk.
green-cip endpoints; a wrapper pinned to an older version may be deprecated or missing categories.Key questions to answer in a spike.
green-cip vs legacy green)?illuminate/* and PHP constraints? Any tests?Stack fit. Written for the Laravel 8–10 / PHP 7.4–8.1 era. If we are on Laravel 11+, plan on either a fork with widened constraints or vendoring the code. There is no meaningful upstream to wait on.
Migration path. Do not let the package leak into call sites. Define our own ContentModerator contract with methods for text, image, and video-submission, and implement it with this package behind it. That makes the package an implementation detail we can replace with Alibaba's official alibabacloud/green SDK, a competing vendor (Tencent, Volcano, self-hosted), or an in-house client without touching product code. Given the maturity signals, the realistic posture is: use the package as a reference implementation to fork and own, not as a dependency of record.
Compatibility prerequisites. Verified Aliyun account; RAM sub-account scoped to Green only; chosen region confirmed against where our users and data sit; outbound network path to Aliyun endpoints; and, if deploying outside mainland China, an explicit review of cross-border data transfer and content-residency obligations before user content is shipped to Aliyun.
Sequencing.
Maintenance. Expect to own this. No releases in ~18 months, one maintainer, no dependents. MIT means forking is legally trivial — do it early, pin the fork internally, and track Aliyun API deprecation notices yourself. Allocate a small recurring maintenance budget rather than assuming upstream will absorb changes.
Support. The escalation path is Aliyun support tickets, not the package author. Documentation is Chinese-first and GitHub issue traffic is thin at this star count. Ensure someone on the team reads Chinese, or contract for translation of the Aliyun Green API docs — those, not the package README, will be the real reference during incidents.
Scaling. Throughput is bounded by the Aliyun account's QPS quotas and tier, not by PHP. Costs are per-call and volume-driven; image and especially video moderation carry real per-unit pricing — model cost against content volume before committing, and cache on content hash for repeats. Async video requires queue capacity plus a callback receiver sized for spikes, and a worker pool independent of request workers.
Failure modes to design for.
Ramp-up. A Laravel developer reaches working text + image moderation in roughly 1–2 days, most of it Aliyun account setup. The async video pipeline — callback endpoint, idempotency, retries, reconciliation — adds 3–5 days. Policy tuning (thresholds, category selection, appeal workflow) is the largest uncounted effort and should be scheduled as product work with the trust-and-safety owner, not folded into the engineering estimate.
How can I help you explore Laravel packages today?