Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 14, 2024 via composer

giggsey/libphonenumber-for-php 8.13.2

PHP Port of Google's libphonenumber
Package summary
Share
0
issues
2
licenses
1
Apache-2.0
1
MIT
Package created
22 May 2013
Version published
8 Dec 2022
Maintainers
1
Total deps
2
Direct deps
1
License
Apache-2.0

Issues

0
This package has no issues

Licenses

Apache License 2.0

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
1 Packages, Including:
giggsey/libphonenumber-for-php@8.13.2

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
symfony/polyfill-mbstring@v1.29.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of giggsey/libphonenumber-for-php 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
symfony/polyfill-mbstringv1.29.0-MIT
prod

Visualizations

Frequently Asked Questions

What does giggsey/libphonenumber-for-php do?

The giggsey/libphonenumber-for-php is a PHP library designed to parse, format, store and validate international phone numbers. Based on Google's libphonenumber, it provides a comprehensive set of tools for dealing with phone numbers, including functionalities such as geolocation, timezone mapping, and carrier mapping for phone numbers. This library supports a wide range of PHP versions from 5.3 to 8.2 and requires the PECL mbstring extension for operation.

How do you use giggsey/libphonenumber-for-php?

You can use giggsey/libphonenumber-for-php primarily through its PhoneNumberUtil class. Here's how to parse and validate a Swiss phone number, for instance:

$swissNumberStr = "044 668 18 00";
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
try {
    $swissNumberProto = $phoneUtil->parse($swissNumberStr, "CH");
    var_dump($swissNumberProto);
} catch (\libphonenumber\NumberParseException $e) {
    var_dump($e);
}

$isValid = $phoneUtil->isValidNumber($swissNumberProto);
var_dump($isValid); // should output true if the number is valid

You can also format the parsed phone number in different ways:

echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::E164); // outputs "+41446681800"
echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::NATIONAL); // outputs "044 668 18 00"
echo $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::INTERNATIONAL); // outputs "+41 44 668 18 00"

Mapping a phone number to its carrier or timezone is as easy as:

$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
$swissNumberProto = $phoneUtil->parse("798765432", "CH");
$carrierMapper = \libphonenumber\PhoneNumberToCarrierMapper::getInstance();
echo $carrierMapper->getNameForNumber($swissNumberProto, "en"); // outputs "Swisscom"

$timeZoneMapper = \libphonenumber\PhoneNumberToTimeZonesMapper::getInstance();
$timeZones = $timeZoneMapper->getTimeZonesForNumber($swissNumberProto); // returns array("Europe/Zurich")

Where are the giggsey/libphonenumber-for-php docs?

The official documentation for the giggsey/libphonenumber-for-php library can be found in the GitHub repository. It includes comprehensive guides and usage examples for each of the library's components, such as PhoneNumber Util, ShortNumber Info, Phone Number Geolocation, and many more. These documents serve as detailed guides to getting the most out of the libphonenumber for PHP library.