PHP code example of tourze / wechat-work-group-chat-bundle
1. Go to this page and download the library: Download tourze/wechat-work-group-chat-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tourze / wechat-work-group-chat-bundle example snippets
use WechatWorkGroupChatBundle\Entity\GroupChat;
use WechatWorkGroupChatBundle\Entity\GroupMember;
use WechatWorkGroupChatBundle\Repository\GroupChatRepository;
// Get all group chats
$groupChats = $entityManager->getRepository(GroupChat::class)->findAll();
// Find group chat by specific criteria
$groupChat = $entityManager->getRepository(GroupChat::class)->findOneBy(['chatId' => 'chat_id']);
// Get group members
$members = $entityManager->getRepository(GroupMember::class)->findBy(['groupChat' => $groupChat]);
// Sync group chat data using console command
// php bin/console wechat-work:sync-group-chat-list
// Custom query for active group chats
$activeChats = $groupChatRepository->findBy(['status' => GroupChatStatus::NORMAL]);
// Get groups with member count
$groupsWithMembers = $groupChatRepository
->createQueryBuilder('g')
->select('g, COUNT(m.id) as memberCount')
->leftJoin('g.members', 'm')
->groupBy('g.id')
->getQuery()
->getResult();
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class GroupChatSyncSubscriber implements EventSubscriberInterface
{
public function onGroupChatSynced(GroupChatSyncedEvent $event): void
{
// Custom logic after group chat sync
}
public static function getSubscribedEvents(): array
{
return [
GroupChatSyncedEvent::class => 'onGroupChatSynced',
];
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.