A useful set of classes and interfaces for storing contact information
This module's main purpose is to provide a set of common interfaces for a persons contact details. It includes interfaces for
- Contact Objects :
SclContact\ContactInterface(aggregates all other interfaces)
- A persons name :
- Phone numbers :
- Email address :
- Postal address :
- Postcode :
- Country :
This module also contains a basic implementation of each interface which can be used or extend.
The names of the address properties are based on addresses in the United Kingdom.
It will work fine for other countries but it has methods like
where people from the USA might expect
The contact interface provides for 1 phone number and 1 fax number. A more flexible approach might be to have a flexible number of phone numbers with a type (mobile, fax, home, work, etc).
There are no social network fields, it might make sense to add these in the no so distant future.
Installation is easy via composer, simple run:
php composer.phar require sclinternet/scl-contact:dev-master
SclContact to your ZF2 application's modules config.
2 fieldsets are provided, these are:
To use these it is recommended that you use Zend Framework 2.2's
FormElementManager to build your forms.
There are also 2 Hydrators
Again to use these it is recommended that you used Zend Framework 2.2's
Not yet implementated. Will be done by 0.1 release.
Country objects are assigned to Address objects via a CountryMananger. There
is a default
SclContact\Country\CountryManager provided which simply returns
country objects with with the provided 2 digit country code. However you can
implement your own country manager froom
if you wish to do things like connect up address records with a country table
in your database.
Once you have created your own implementation of
SclContact\Country\CountryManagerInterface simply specify it in your config
like so to use it:
return array( 'scl_contact' => array( 'country_manager' => 'MyApplication\MyCountryManager', ), );
Feel free to fork or make feature requests.