Download the PHP package settermjd/laminas-twilio-phone-number-validator without Composer

On this page you can find all versions of the php package settermjd/laminas-twilio-phone-number-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laminas-twilio-phone-number-validator

Phone Number Validator that uses Twilio's Lookup (V2) API

Build Status

This is a custom laminas-validator class that checks if a phone number is valid by using Twilio's Lookup API.

Overview

The package provides a custom laminas-validator class that checks if a phone number is valid by using Twilio's Lookup API, providing a simple way of validating phone numbers are valid, based on communications provider data, accessed through Twilio.

Requirements

To use the application, you'll need the following:

Getting Started

Add the Package as a Project Dependency

To use the package in your project, first, either add it in composer.json's require attribute, as in the example below.

Or, use composer require to add it:

How to Use the Validator

You can use it directly, as in the following example, to validate a phone number.

Or, you can use it in conjunction with laminas-inputfilter, as in the following example.

In both of the above examples, the VerifyPhoneNumber validator is initialised with a Twilio\Rest\Client object, which in turn is initialised with a Twilio Account SID and Auth Token. To retrieve these, open the Twilio Console in your browser of choice, then copy the Account SID and Auth Token from the Account Info, as you can see in the screenshot below.

[!CAUTION] Use a package such as PHP Dotenv to keep credentials, such as the Twilio Account SID and Auth Token out of code, and avoid them accidentally being tracked by Git (or your version control tool of choice), or your deployment tool's secrets manager is strongly encouraged.

Supply query parameters

The previous example didn't supply any query parameters. They allow you to retrieve additional data during the lookup, such as when the SIM was last swapped, and whether call forwarding is enabled.

[!CAUTION] Be aware that some query parameters, such as in Fields require data packages which will incur charges on your account. Please double-check your code before running it so that you don't accidentally incur excessive unintended Lookup charges.

Filter and validate query parameters

To ensure that the query parameters provided to the validator are valid, you can use the QueryParametersInputFilter. This is a custom laminas-inputfilter class which ensures that the query parameter data provided is valid, and doesn't contain malicious information or values unsupported by the Lookup API.

In the example above, the query parameters ($suppliedQueryParameters) are checked with QueryParametersInputFilter. If the data is valid, then the VerifyPhoneNumber validator is instantiated and used; that code is exactly the same as in the first example above.

Add Caching Support

The validator is PSR-16-compliant. So, if you want to further enhance performance, when initialising a VerifyPhoneNumber object, provide an object that implements CacheInterface as the third argument; the example below uses laminas-cache.

If you're not sure which PSR-16 implementation to use, check out the full list of providers on Packagist.

Contributing

If you want to contribute to the project, whether you have found issues with it or just want to improve it, here's how:

Did You Find the Project Useful?

If the project was useful, and you want to say thank you and/or support its active development, here's how:


All versions of laminas-twilio-phone-number-validator with dependencies

PHP Build Version
Package Version
Requires php Version ~8.3.0 || ~8.4.0
laminas/laminas-coding-standard Version ^3.0
laminas/laminas-inputfilter Version ^2.31
laminas/laminas-validator Version ^2.60.0
twilio/sdk Version ^8.3
vlucas/phpdotenv Version ^5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package settermjd/laminas-twilio-phone-number-validator contains the following files

Loading the files please wait ....