Download the PHP package dhalsted/sms-utils without Composer

On this page you can find all versions of the php package dhalsted/sms-utils. 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 sms-utils

sms-utils

sms-utils contains methods I've found useful for handling text messaging. I primarily use Twilio for this but eventually I hope to add support for other vendors.

The first version contains code to validate that a string represents a valid SMS number--something that Twilio won't choke on. This means it must meet certain formatting restrictions and, in addition, must be a number for a text-capable phone (ie, not a landline). The rules for this are complicated. The SMS Validator class will take a string, check that it can be parsed as a phone number, check that it is not a landline, and return a version of the number formatted for use with Twilio. It can handle numbers from different countries and regions. Format validation is handled through Google's libphonenumber and the check for SMS capability is run through Twilio.

Note that you'll need Twilio API credentials to use the Validator.

Installation

Clone or download the repository. Then

To run tests, first copy .env.example to .env and then run

This will run a set of tests that don't require Twilio credentials. To run a more complete set of tests, fill in .env with Twilio credentials and some sample phone numbers, and then do

again.

Quickstart

To use the validator, do something like

where (444) 111-2222 is a valid US landline. You should get

Then try it with a mobile number. In this case, you'll get back

To call the SMSValidator class in your own code, just do

By default, the Validator checks whether the submitted phone number is a mobile or VoIP number. If you want to check specifically for one or the other, do something like this:

SMSValidator throws several kinds of exceptions which can help your users understand why a number will not work for texts.


All versions of sms-utils with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
twilio/sdk Version ^5.5
giggsey/libphonenumber-for-php Version ^8.8
vlucas/phpdotenv Version ^2.4@dev
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 dhalsted/sms-utils contains the following files

Loading the files please wait ....