tourze/wechat-work-contracts
Interfaces and contract definitions for integrating WeChat Work (企业微信) into PHP applications. Provides shared, type-safe abstractions that decouple implementations from usage, making WeChat Work services easier to swap, mock, and test within the Tourze ecosystem.
Install the contracts package and inspect composer.json, README, src/, and the changelog/diff between 0.0.5 and 1.0.2 before adopting it:
composer require tourze/wechat-work-contracts
This package provides contracts/interfaces for WeChat Work/WeCom integration. It is not an end-to-end SDK, so the first practical use case is to define your own adapter implementation and bind it into Laravel’s container.
Start by finding the contract you need in src/, for example the interface representing message sending, access-token handling, contacts/departments, agents, or callbacks. Then bind an implementation in a service provider:
// app/Providers/AppServiceProvider.php
public function register(): void
{
$this->app->bind(
\Tourze\WechatWorkContracts\SomeContract::class, // replace with the actual interface
\App\Integrations\WeCom\SomeImplementation::class
);
}
Use constructor injection in application services, jobs, and actions:
final class SendWeComNotification
{
public function __construct(
private readonly \Tourze\WechatWorkContracts\SomeContract $client
) {}
public function handle(): void
{
// Call the contract, not a vendor-specific SDK directly.
}
}
Treat 1.0.2 as the stable 1.x line. Because the jump is from 0.0.5 to 1.0.2, review the full changelog/diff for breaking signature changes before upgrading existing code.
WeComServiceProvider rather than scattering new calls. This makes testing and replacement easier.sendText(), sendTextCard(), getUser(), or syncDepartment() from your own service so controllers and jobs do not know WeCom payload details.composer.json under extra.laravel.providers. Contracts-only packages may not ship one, so your app may need to register bindings manually.^1.0 constraint across the application to avoid mixed contract majors.0.0.5 may be breaking. Even though 1.0.2 is a patch on 1.x, moving from 0.x to 1.x often includes incompatible API changes. Search your codebase for implementations of package interfaces and run static analysis after upgrading.php artisan config:clear and composer dump-autoload when debugging container resolution.1.0.2 notes are minimal; the compare link is the authoritative source for patch-level changes.How can I help you explore Laravel packages today?