sclinternet / scl-contact
一组用于存储联系信息的类和接口
Requires
- php: >=5.3.3
Requires (Dev)
- phpmd/phpmd: 1.4.0
- phpunit/phpunit: 3.7.*
- satooshi/php-coveralls: dev-master
- squizlabs/php_codesniffer: 1.*
- zendframework/zendframework: 2.2.*
This package is not auto-updated.
Last update: 2024-09-14 14:29:39 UTC
README
本模块的主要目的是为个人联系信息提供一套通用接口。它包括以下接口:
- 联系对象 :
SclContact\ContactInterface
(聚合所有其他接口) - 个人姓名 :
SclContact\PersonNameInterface
- 电话号码 :
SclContact\PhoneNumberInterface
- 电子邮件地址 :
SclContact\EmailInterface
- 邮寄地址 :
SclContact\AddressInterface
- 邮编 :
SclContact\PostcodeInterface
- 国家 :
SclContact\CountryInterface
本模块还包含每个接口的基本实现,可以用于或扩展。
限制
地址属性的名称基于英国地址。它将适用于其他国家,但它有如 getCounty()
这样可能让美国用户期望 getState()
的方法。
联系接口提供1个电话号码和1个传真号码。可能有一个更灵活的方法,即具有类型(手机、传真、住宅、工作等)的可变数量电话号码。
没有社交网络字段,将来可能有必要添加这些。
安装
通过composer轻松安装,只需简单运行
php composer.phar require sclinternet/scl-contact:dev-master
然后向您的ZF2应用程序的模块配置中添加 SclContact
。
字段集
提供了2个字段集,它们是
SclContact\Form\Fieldset\Contact
SclContact\Form\Fieldset\Address
为了使用这些字段集,建议您使用Zend Framework 2.2的 FormElementManager
来构建表单。
Hydrators
还有2个Hydrators
SclContact\Hydrator\ContactHydrator
SclContact\Hydrator\AddressHydrator
同样,为了使用这些Hydrators,建议您使用Zend Framework 2.2的 HydratorManager
。
InputFilters
尚未实现。将在0.1版本中完成。
CountryManager
通过CountryManager将国家对象分配给Address对象。提供了一个默认的 SclContact\Country\CountryManager
,它简单地返回具有提供两位国家代码的国家对象。然而,如果您想将地址记录与数据库中的国家表连接起来,可以实现自己的国家管理器,从 SclContact\Country\CountryManagerInterface
。
一旦您创建了 SclContact\Country\CountryManagerInterface
的实现,只需在配置中指定它,如下所示以使用它
return array( 'scl_contact' => array( 'country_manager' => 'MyApplication\MyCountryManager', ), );
贡献和使用
请随意分支或提出功能请求。