chowjiawei/laravel-help-plugin
A lightweight Laravel helper package offering a collection of practical utility functions for common development tasks. It helps streamline everyday PHP and Laravel workflows, reduce boilerplate, and keep your application code cleaner, more readable, and easier to maintain.
Install and publish
composer require chowjiawei/laravel-help-plugin
php artisan vendor:publish --provider="Chowjiawei\LaravelHelp\HelpServiceProvider"
If the package does not ship auto-discovery (older Chinese packages sometimes don't), register the provider and any facade manually in config/app.php. Check the repo's composer.json extra.laravel block first — that tells you what's auto-registered.
Where to look first
config/help.php (or whatever the published config is named) — this is the map of everything the package does. Read it top to bottom; it will list the DingTalk/WeCom webhook keys, WeChat app credentials, openexchangerates app id, Douyin/TikTok shop credentials, and any default currency/country settings.src/ for the service classes and any Facades/ directory — the public surface is usually a handful of facades plus a notification channel.First use case
The lowest-risk entry point is the DingTalk or WeCom robot notifier, because it needs only a webhook URL and no OAuth flow. Wire it inline:
use Chowjiawei\LaravelHelp\Facades\Help; // verify exact facade name in src/
Help::dingTalk()->text('Deploy finished on prod');
Then move to the country list and pinyin helpers, which are pure functions and safe to unit-test without credentials. Only after those work should you touch WeChat template messages or the Douyin/TikTok payment flows, which require real merchant credentials and sandbox environments.
Laravel notifications (the recommended integration)
The description explicitly mentions "消息通知" with WeChat template/broadcast drivers. The cleanest fit is to treat these as notification channels, so business code stays decoupled:
// app/Notifications/OrderPaid.php
public function via($notifiable): array
{
return ['wechat_template', 'dingtalk'];
}
public function toWeChatTemplate($notifiable): array
{
return [
'template_id' => config('help.wechat.templates.order_paid'),
'url' => route('orders.show', $this->order),
'data' => [
'first' => 'Order paid',
'keyword1' => $this->order->number,
'keyword2' => number_format($this->order->total, 2),
],
];
}
Then $user->notify(new OrderPaid($order)). Verify the channel class names against the package source — Chinese packages frequently name them differently from Laravel convention.
Robot webhooks for ops alerts
Both DingTalk and WeCom robots are webhook-based and stateless. Wrap them in a small OpsAlert service so you can swap transports later:
class OpsAlert
{
public function __construct(private string $channel = 'dingtalk') {}
public function send(string $message, array $atMobiles = []): void
{
match ($this->channel) {
'dingtalk' => Help::dingTalk()->at($atMobiles)->markdown('Alert', $message),
'wecom' => Help::weCom()->text($message),
};
}
}
Use these for deployment notices, queue-failure alerts, and payment-callback mismatches — the highest-value use of a package like this.
Exchange rates: cache aggressively
openexchangerates free tiers are rate-limited and per-app-id. Never call it inline in a request. Pattern:
$rate = Cache::remember("fx:{$from}:{$to}", now()->addHours(6), function () use ($from, $to) {
return Help::exchangeRate()->convert($from, $to); // verify method signature
});
For settlement math where the rate must be locked to the order, persist the rate on the order row at creation time and use the package only to fetch it. The "custom rate" feature is for exactly this — overriding upstream rates with a negotiated/contract rate.
Country list + pinyin
Country list is a lookup — cache it once per process. The pinyin feature converts Chinese pinyin to Wade-Giles, which is unusual (most devs expect Hanyu Pinyin or slug generation). Use it only if you actually need Wade-Giles output for names or shipping labels; otherwise use a dedicated transliteration package.
Douyin / TikTok pay flows
Follow the standard two-phase pattern regardless of how the package exposes it:
out_order_no before calling the API.out_order_no, make the state transition idempotent inside a DB transaction, then acknowledge to the platform.Never trust the callback body for the amount — re-query the platform's order status with your stored order. Douyin and TikTok both provide query endpoints; the package should expose them alongside create/pay.
composer.json ("chowjiawei/laravel-help-plugin": "^1.2" rather than *) and read src/ before relying on a method signature. Treat the README as a hint, not a contract. Add a thin wrapper class around each feature so you can swap the package out without touching business code.php artisan config:cache, any config() call that reads a published config file with unusual keys still works — but if the package reads env() directly at runtime, it will return null in production. Grep the source for env( outside config/ and move those into your .env + config file if needed.DB::transaction and guard with a unique index on (platform, out_order_no) or a payment_events table keyed by the platform's event id. Duplicate callbacks returning 500 will cause repeated retries and can look like a failed order to the platform.bcmath or intdiv on minor units, not round(). Payment amounts in CNY should be integer fen. The package may hand you raw platform integers; don't mix them with a float-typed local column.Zhāng Wěi-style output you'll get Chang Wei-style instead. Check before shipping it into user-facing URLs or slugs.send() without forking. If it uses facades with a getFacadeAccessor() binding, you can app()->bind() a decorator around the underlying service in a service provider — this is usually the cleanest way to add retry/circuit-breaker logic around the exchange-rate and payment calls.app/ namespace. If the package goes stale you can reimplement one interface at a time rather than rewrite integration code.How can I help you explore Laravel packages today?