onedrop/phoneutil

Utilities to deal with phone numbers

Installs: 2 591

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 0

Open Issues: 0

Type:neos-package

0.1.1 2017-10-05 13:05 UTC

This package is auto-updated.

Last update: 2024-04-25 06:30:00 UTC


README

This Neos package provides some functionality to deal with phone numbers in your daily work with Flow and Neos.

Validation

<?php
namespace Vendor\Package\Domain\Model;
use Neos\Flow\Annotations as Flow;

class SomeEntity {
    /**
     * @var string
     * @Flow\Validate(type="Onedrop.PhoneUtil:PhoneNumber")
     */
     protected $phoneNumber;
}

Eel utility

Reformat into daillable number (output as tel: link):

phoneNumber = ${Phone.toDiallableNumber(q(node).property('number'), 'DE')}
# output '+4989123456789'

Geocode the phone number:

city = ${Phone.geocode(q(node).property('number'), 'DE')}
# output 'München'
city = ${Phone.geocode(q(node).property('number'), 'EN')}
# output 'Munich'

Extract numbers from a text:

phoneNumbersInText = ${Phone.extractNumbers(q(node).property('description'), 'DE')}
# outputs a RawArray containing the the possible phone numbers (unmodified)

Typeahead ajax formatting

A special endpoint __phone/format is provided.