tourze/wechat-work-contracts
Composer 安装命令:
composer require tourze/wechat-work-contracts
包简介
企业微信 API 接口定义和数据契约
README 文档
README
WeChat Work (Enterprise WeChat) contracts and interfaces definitions for PHP applications.
Features
- 🏢 Enterprise Management - Standard interfaces for WeChat Work enterprise information
- 👥 User Management - Contracts for user/employee data handling
- 🏗️ Department Management - Interfaces for organizational structure
- 🤖 Agent Management - Application agent configuration contracts
- 🔄 User Operations - User loading and creation interface definitions
- 📋 Type Safe - Full PHP 8.1+ type hints and nullable return types
- 🎯 Focused - Minimal, focused contracts without implementation details
Installation
composer require tourze/wechat-work-contracts
Quick Start
<?php use Tourze\WechatWorkContracts\UserInterface; use Tourze\WechatWorkContracts\CorpInterface; use Tourze\WechatWorkContracts\AgentInterface; use Tourze\WechatWorkContracts\UserLoaderInterface; // Implement the interfaces in your application class MyWechatUser implements UserInterface { public function getUserId(): ?string { return $this->userId; } public function getName(): ?string { return $this->name; } } class MyUserLoader implements UserLoaderInterface { public function loadUserByUserIdAndCorp(string $userId, CorpInterface $corp): ?UserInterface { // Your implementation to load user from WeChat Work API return new MyWechatUser($userId); } public function createUser(CorpInterface $corp, AgentInterface $agent, string $userId, string $name): UserInterface { // Your implementation to create user return new MyWechatUser($userId, $name); } }
Overview
This package provides common contracts and interfaces for WeChat Work (Enterprise WeChat) integration. It defines standard interfaces for:
- AgentInterface - Application agent management
- CorpInterface - Enterprise/Corporation information
- DepartmentInterface - Department management
- UserInterface - User/Employee information
- UserLoaderInterface - User loading and creation operations
Interfaces
AgentInterface
Defines methods for WeChat Work application agents:
interface AgentInterface { public function getAgentId(): ?string; public function getWelcomeText(): ?string; }
CorpInterface
Defines methods for enterprise information:
interface CorpInterface { public function getCorpId(): ?string; }
DepartmentInterface
Defines methods for department management:
interface DepartmentInterface { public function getId(): ?int; public function getName(): string; }
UserInterface
Defines methods for user/employee information:
interface UserInterface { public function getUserId(): ?string; public function getName(): ?string; }
UserLoaderInterface
Defines methods for user loading and creation:
interface UserLoaderInterface { public function loadUserByUserIdAndCorp(string $userId, CorpInterface $corp): ?UserInterface; public function createUser(CorpInterface $corp, AgentInterface $agent, string $userId, string $name): UserInterface; }
Usage
These interfaces are meant to be implemented by concrete classes in your WeChat Work integration packages. They provide a standardized way to work with WeChat Work entities across different implementations.
Requirements
- PHP 8.1 or higher
License
MIT License
Reference Documentation
tourze/wechat-work-contracts 适用场景与选型建议
tourze/wechat-work-contracts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.38k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tourze/wechat-work-contracts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tourze/wechat-work-contracts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 15
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-03