Download the PHP package prinx/txtconnect without Composer

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

Build Status Latest Stable Version License StyleCI

TXTCONNECT PHP SDK

TXTCONNECT is a platform that allows you to send SMS and voice messages to your specified contact list.

This package provides a convenient way of interacting with TXTCONNECT's API. It allows you to send SMS, check your SMS status, get your SMS inbox, check your account balance, without worrying about direct API calls.

Then you are ready to go.

Installation

Usage

Configuration

Create a .env file at the root of your project (where the vendor folder is located), if none exists already.

In the .env file specify your TxtConnect API credentials:

Sending SMS

Specifying the HTTP method

Number formats

The number is automatically sanitized, any space, parenthesis, hyphen, is removed. This allows to pass the number without worrying about the correct format.

For example:

The only constraint is the number has to be in an international format. This constraint can be ignored by specifying a default country.

Specifying the default country

Specifying a default country allows to send SMS without worrying if the number is in international format or not. The package will automatically resolve and put the number in required format. For example, after specifying the default country as Ghana, you can send SMS to the number like 020 00 00 000, without putting it in international format.

Sending SMS to more than one number

You can send SMS to many numbers at once just by adding the numbers as an array to the send method:

Using the to method

The phone numbers can be passed to the sms instance ahead of time, before calling the send method:

And for more numbers:

or

or

Handling duplicate

By default, the package handles automatically duplicate numbers and does not send sms to duplicate numbers (unless it is explicitly activated).

Sending to duplicate

If you wish to send sms to duplicate numbers, you can activate it by calling the keepDuplicate method on the sms instance.

Deactivate sending to duplicate

If you wish to send sms to duplicate numbers, you can activate it by calling the removeDuplicate method on the sms instance.

Invalid numbers

Sms will not be forwarded to invalid numbers.

Invalid numbers are:

This allows you not to waste bandwidth to make HTTP request to numbers that will not get the message you are sending and at the same time allows not to waste you TXTCONNECT balance.

SMS response

After sending an SMS, the response let you know if the SMS has been received by TXTCONNECT or if an error happened.

Single SMS response

When sending an SMS to only one contact, the send method will return an SmsResponse instance:

Multiple SMS response (SmsResponseBag)

When sending SMS to multiple contacts, the send method will return an SmsResponseBag containing the SmsResponse of every contact:

The first and last response can be accessed using the first and last method:

Forcing SmsResponseBag

You can force the send method to always return a SmsResponseBag weither the SMS has been sent to only one number or multiple numbers by calling the asBag method on the sms instance:

Get SMS status

Get Status of many SMS at a go

Adding batch number one by one

Batch numbers can be added one by one instead of passing all as an array to the of method:

Fluent interface

The SmsStatus class implement a fluent interface, so the of method can be chained:

Using first and last

The SmsStatus class also extends the SmsBagAbstract, so when retrieveing statuses of more than one batch numbers, the first and last elements can be retrieved using the first and last method:

All the statuses fetched
Count number of statuses fetched

Get Balance

Get SMS Inbox

Contributing

License

MIT


All versions of txtconnect with dependencies

PHP Build Version
Package Version
Requires giggsey/libphonenumber-for-php Version ^8.12
symfony/http-client Version ^6.1
league/iso3166 Version ^4.1
prinx/notify Version ^0.1
prinx/slack-log Version ^2.0
prinx/dotenv Version ^1.0
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 prinx/txtconnect contains the following files

Loading the files please wait ....