<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tourze / wechat-work-external-contact-model example snippets
use Tourze\WechatWorkExternalContactModel\ContactType;
// Get contact type label
echo ContactType::WECHAT->getLabel(); // 'WeChat User'
echo ContactType::WEWORK->getLabel(); // 'WeChat Work User'
// Get all contact types for select options
$options = ContactType::getSelectOptions();
use Tourze\WechatWorkExternalContactModel\ExternalContactInterface;
class MyExternalContact implements ExternalContactInterface
{
public function getExternalUserId(): ?string
{
// Return the external user ID
return $this->externalUserId;
}
public function getUnionId(): ?string
{
// Return the union ID
return $this->unionId;
}
public function getNickname(): ?string
{
// Return the nickname
return $this->nickname;
}
public function getAvatar(): ?string
{
// Return the avatar URL
return $this->avatar;
}
}
use Tourze\WechatWorkExternalContactModel\ExternalUserLoaderInterface;
use Tourze\WechatWorkContracts\CorpInterface;
class MyExternalUserLoader implements ExternalUserLoaderInterface
{
public function loadByUnionIdAndCorp(string $unionId, CorpInterface $corp): ?ExternalContactInterface
{
// Load external contact by union ID and corporation
return $this->findExternalContact($unionId, $corp);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.