onedrop / phoneutil
处理电话号码的实用工具
0.1.1
2017-10-05 13:05 UTC
Requires
This package is auto-updated.
Last update: 2024-09-25 07:32:50 UTC
README
此Neos包提供了一些在Flow和Neos日常工作中处理电话号码的功能。
验证
<?php namespace Vendor\Package\Domain\Model; use Neos\Flow\Annotations as Flow; class SomeEntity { /** * @var string * @Flow\Validate(type="Onedrop.PhoneUtil:PhoneNumber") */ protected $phoneNumber; }
Eel实用工具
重新格式化为可拨打号码(输出为tel:链接)
phoneNumber = ${Phone.toDiallableNumber(q(node).property('number'), 'DE')}
# output '+4989123456789'
对电话号码进行地理编码
city = ${Phone.geocode(q(node).property('number'), 'DE')}
# output 'München'
city = ${Phone.geocode(q(node).property('number'), 'EN')}
# output 'Munich'
从文本中提取数字
phoneNumbersInText = ${Phone.extractNumbers(q(node).property('description'), 'DE')}
# outputs a RawArray containing the the possible phone numbers (unmodified)
自动补全ajax格式化
提供了一个特殊端点__phone/format
。