potatopowered/phone-helper
Composer 安装命令:
composer require potatopowered/phone-helper
包简介
A CakePHP 3.x telephone number formatting plugin.
README 文档
README
A phone number formatting helper for CakePHP 3.x
Description
The phone number helper is designed to help format phone numbers of all types into tel links or just a prettified format. Please send a pull request if you do not see your phone number format included.
Installation
composer require potatopowered/phone-helper
Add the helper to the public helpers variable of the controller you need it on or in the AppController to have it accessible in all controllers.
public $helpers = [
'Phone' => [
'className' => 'PhoneHelper.Phone'
]
];
Usage
To use the phone number formatter you must have the helper loaded in your controller.
Once loaded in the controller as shown above you can call the number helper's format($number)
function.
// (123) 456-789
$this->Phone->format('1234567890');
// 456-7890
$this->Phone->format('4567890');
You can also add telephone links in RFC3966 format using the 'link' method
// <a href="tel:+1234567890">123-456-7890</a>
$this->Phone->link('123-456-7890');
// <a href="tel:+1234567890">Call Us</a>
$this->Phone->link(h('Call Us'), '1234567890');
统计信息
- 总下载量: 12.52k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-20