承接 dniccum/phone-number 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dniccum/phone-number

Composer 安装命令:

composer require dniccum/phone-number

包简介

A Laravel Nova phone number field with input masking and validation support.

README 文档

README

Laravel Nova Phone Number Field

Latest Version on Packagist License Total Downloads

A Laravel Nova field to format using a dynamic input mask and additional phone number validation.

NOTE: This field utilizes Propaganistas / Laravel-Phone package for validation.

Image 1

Installation

To install this tool, use the installation code below:

composer require dniccum/phone-number

Code

To use the field, add the following code to your Nova resource. As this is a field, all of the default field properties can be applied.

use Dniccum\PhoneNumber\PhoneNumber;

PhoneNumber::make('Phone Number')

Options

To support multiple types and formats of phone numbers, this field has multiple methods for input masking and validation that are available.

Defaults

Method/Options Default
format string: '(###) ###-####'
placeholder string: '[Name of Field]'
useMaskPlaceholder boolean: false
country string: 'US'
countries string[]: ['US']
disableValidation boolean: false
linkOnIndex boolean: false
linkOnDetail boolean: false

format

PhoneNumber::make('Phone Number')
    ->format('###-###-####')

Type: string

Default: (###) ###-####

This is the value that the javascript controlling the input mask will use define it's values; and depending the field's configuration the placeholder text. To indicate numbers, use the hash (#) symbol.

Note: Other types of content can be included within this input like an phone extension:

PhoneNumber::make('Phone Number')
    ->format('###-###-#### ext ####')

However the built-in phone number validation will FAIL as this is technically an invalid phone number. To prevent the validation from failing, turn off the phone number validation like so:

PhoneNumber::make('Phone Number')
    ->format('###-###-####')
    ->disableValidation()

placeholder

PhoneNumber::make('Phone Number')
    ->placeholder('Personal Home Number')

Type: string

Default: [Name of the Field]

If you would like to override the default placeholder supplied by Nova, which is the name of field, user a simple string.

Note: If you are telling the input to override the placeholder by using the input's mask with the useMaskPlaceholder method, this will not work.

useMaskPlaceholder

PhoneNumber::make('Phone Number')
    ->useMaskPlaceholder()

Type: boolean

Default: false

This will tell the field to replace the input's defined placeholder with the input mask from the ->format() method.

country

PhoneNumber::make('Phone Number')
    ->country('CA')

Type: string

Default: US

This tells the field what type of phone number validation to use. To define a type of validation, define a ISO 3166-1 alpha-2 compliant country code.

You can only define one country here. If you would like to define more than one, please see the ->countries() method.

NOTE: This field utilizes Propaganistas / Laravel-Phone package for validation.

countries

PhoneNumber::make('Phone Number')
    ->countries(['US', 'CA'])

Type: string[]

Default: US

If you would like to define more than one country to validate against, define string-based array of ISO 3166-1 alpha-2 compliant country codes.

NOTE: This field utilizes Propaganistas / Laravel-Phone package for validation.

linkOnIndex

PhoneNumber::make('Phone Number')
    ->linkOnIndex()

Type: boolean

Default: false

Render's the phone number as a clickable link on the index view.

linkOnDetail

PhoneNumber::make('Phone Number')
    ->linkOnDetail()

Type: boolean

Default: false

Render's the phone number as a clickable link on the detail view.

Credits

License

The MIT License (MIT). Please see License File for more information.

dniccum/phone-number 适用场景与选型建议

dniccum/phone-number 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 463.71k 次下载、GitHub Stars 达 70, 最近一次更新时间为 2018 年 09 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「number」 「phone」 「nova」 「laravel」 「field」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dniccum/phone-number 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dniccum/phone-number 我们能提供哪些服务?
定制开发 / 二次开发

基于 dniccum/phone-number 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 463.71k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 70
  • 点击次数: 29
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 70
  • Watchers: 2
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-26