Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ali Safe Api Laravel Package

james.xue/ali-safe-api

Laravel wrapper for Alibaba Cloud content safety (Green) API. Moderate text, images, videos, and audio for porn, politics, terrorism, ads, and more with a simple facade and config. Multiple scenes and PSR-friendly responses make it easy to plug into upload and publishing flows.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

Build vs. buy on content safety. This package exists to answer one question cheaply: "do we need a moderation team, or can we rent one?" It wraps Alibaba Cloud's content moderation API (绿网 / Green Web) behind a Laravel-idiomatic facade, so the real decision it unlocks is buy the model, own the workflow — you still own thresholds, review queues, appeals, and takedown policy, but you don't own a classifier.

Feature decisions it de-risks. Anything where user-generated content becomes visible to other users:

  • Comments, reviews, ratings, Q&A, forums, DMs
  • Marketplace listings, titles, descriptions, seller chat
  • Profile fields: nicknames, bios, avatars, banners
  • Image uploads: porn, terrorism/violence, politically sensitive imagery, advertising/watermarks, QR codes (the underrated one — QR moderation is a fraud/scam vector, not a taste issue)

Roadmap sequencing. Moderation is usually a hidden tax on every UGC feature. Committing to a provider lets you schedule community, marketplace, or social features without a parallel ML workstream. Conversely, if you can't pick a provider, that's a signal to defer UGC-heavy roadmap items.

Architecture decisions the integration forces. Moderating inline in a PHP request adds 100–500ms+ and a hard external dependency on your publish path. The package's existence is a prompt to decide up front:

  • Synchronous pre-publish blocking (safe, slow, kills conversion on image posts)
  • Asynchronous post-publish with takedown (fast, needs a review queue and incident process)
  • Hybrid: sync on text, async on images, sync on first N posts per user

Cost and capacity modeling. Per-call pricing differs sharply between text and image moderation, and image moderation is priced per image with volume tiers. This gives you a defensible unit-economics input for the UGC feature's business case.

Compliance posture. For a China-market product, content moderation is a legal obligation (Cybersecurity Law, ICP filing expectations, app store review for UGC). Choosing a domestic provider with domestic data residency is a compliance decision, not just an engineering one — this package makes that decision one composer require away, which is strategically useful in a roadmap conversation about "can we ship UGC in CN at all."

Human-in-the-loop sizing. Any real deployment needs a false-positive review queue and an appeals path. The package gives you machine labels; it says nothing about staffing. That gap is a budget line item you should surface now, not after launch.

When to Consider This Package

Adopt it when:

  • You are on Laravel/PHP and have already decided (or are strongly leaning) on Alibaba Cloud as your moderation provider.
  • Your content is Chinese-language or your market is mainland China. Aliyun's models are tuned for this; Western providers are noticeably worse on Chinese political sensitivity and local slang.
  • Your team is small and integration speed beats abstraction purity. This is a thin wrapper — expect hours, not sprints.
  • You want text + image + ad + QR coverage from a single client without stitching multiple SDKs.

Look elsewhere when:

  • You are not serving China. For US/EU products, AWS Rekognition/Comprehend, Google Cloud Vision, Azure AI Content Safety, or OpenAI's moderation endpoint are better fits on latency, data residency, and contract terms.
  • You need vendor neutrality. This package is a single-vendor wrapper with no adapter layer. Writing your own Moderator interface with an Aliyun adapter is maybe a day of work and buys you the option to switch. For a compliance-critical path, that option is usually worth more than the saved day.
  • You weigh ecosystem validation heavily. 65 stars and 0 dependents is the important number here. Either nobody has found it, or — more likely for a wrapper this thin — everyone just calls the official alibabacloud/sdk directly. For a path that can block publishes or fail open, a single-maintainer dependency with no downstream users is a real risk. Mitigation: pin the version, read the source (it's small), and be prepared to fork.
  • You need more than text and images. Video, audio, live-stream, and document moderation have different APIs and pricing; verify coverage rather than assuming.
  • You need high throughput with tight latency. Inline PHP calls to a remote moderation API don't scale gracefully. At volume, this belongs behind a queue and a dedicated service, at which point the Laravel wrapper is a detail, not an architecture.

The MIT license is a genuine plus: no legal review friction, no copyleft contamination, forking is unambiguously permitted.

How to Pitch It (Stakeholders)

For executives — the one-paragraph version: "Content moderation is a launch gate for any feature where users see each other's content, and in China it's a legal requirement, not a nice-to-have. Building our own classifier is a multi-quarter ML investment we don't need to make. This package lets us rent Alibaba Cloud's moderation models from our existing Laravel codebase in about a day of engineering. Cost is per-call and predictable. The main caveat is that it's a small open-source project — so we'll isolate it behind our own internal interface, which costs us almost nothing and preserves our ability to switch providers if pricing, accuracy, or terms change."

For engineering:

  • Thin Laravel wrapper around Aliyun's content moderation API; text, keywords, image (porn/terror/sensitive), ads, QR codes. MIT licensed.
  • Integration is small — treat the package as a reference implementation as much as a dependency. Expect to wrap it in an internal ModerationService with our own DTOs, retry/timeout policy, and fail-open vs. fail-closed behavior per content type.
  • Flag: 0 dependents, ~65 stars, single maintainer. Pin the version and vendor the source if we're putting it on a publish path.
  • Async-by-default for images; sync only where blocking matters.

For legal/compliance:

  • Content and images leave our infrastructure and go to Alibaba Cloud. Confirm the DPA, data residency region, and retention terms before launch.
  • The provider returns labels and confidence scores; we own the thresholds and the appeals process. Automated moderation does not transfer liability.
  • For China UGC, confirm the provider's credentials meet regulator expectations and that we retain audit logs of moderation decisions and takedowns.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel