Download the PHP package erwane/cakephp-contact without Composer
On this page you can find all versions of the php package erwane/cakephp-contact. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cakephp-contact
CakePHP 5.x plugin to manipulate contact data
CakePHP-Contact is here to help you save, test and display all locality and contact datas like phone & address.
Version map
Contact plugin | branch | CakePHP core | PHP min |
---|---|---|---|
1.x | 1.x | ^3.2 | PHP 7.2 |
2.x | 2.x | ^4.0 | PHP 7.2 |
3.x | 3.x | ^5.0 | PHP 8.1 |
Documentation
- Installation
- Phone numbers
- Utility
- PhoneNumberType
- Validation
- Helper
- Address
- Configuration
Installing with Composer
Use composer to install it
Phone numbers
Utility
Contact\Utility\Phone::format(?string $text = null, array $options = [])
$text
is string or null
$options
is an array with this possible options and output
country
: a country code likeFR
orUK
format
:international
: +33 1 23 45 67 89national
: 01 23 45 67 89uri
: tel:+33-1-23-45-67-89short
: +33123456789
PhoneNumberType
The phone number database type automatically format request data to an E164 phone number (+33....) It also format phone number from unformated database result.
How to use PhoneNumberType
Default country
Phone number in forms are set in the user country format, like 0123456789
for France. But there can be conflict, depends of the user Country who fill the form.
You can set defaultCountry
for all phone number not set in international format.
Now, all non international form phone numbers was formated with +32 prefix
Phone number validation
Contact plugin provide a simple phone number validation rule
Phone Helper
You can format a phone number in a really simple manner;
Address trait
This trait must be attached to \Cake\ORM\Entity
in your App. It take address data from Entity fields and format it to standard array or string format.
The fields and format can be configured in Entity or by method.
Default
Address fields matching
By default, address will be extracted from this fields :
Data can be in an associated model. Use dot format Countries.title
to set it.
Address text format
Address text ($entity->address_text
) use Cake\Utility\Text::insert()
method to format fields.
Default address text format is :
Address trait configuration
You can change default configuration in two ways.
With methods
In entity
All versions of cakephp-contact with dependencies
ext-json Version *
cakephp/cakephp Version ^5.0
giggsey/libphonenumber-for-php Version ^8.13