Download the PHP package smsapi/php-client without Composer

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

SMSAPI PHP Client

Build Status Packagist - latest version Packagist - downloads Packagist - license

Version 1.8.7 available here

SMSAPI.COM API documentation

SMSAPI.PL API documentation

Requirements

Install package with dependencies

Execute: composer require smsapi/php-client

How to pick a service

Depending on which of SMSAPI service your account is, you should pick it calling one of a method from examples below:

PSR-17 and PSR-18

Starting from version 3, SMSAPI PHP Client supports PSR-17 and PSR-18 compliant HTTP clients. That way this library is independent of client of your choice. You have to provide HTTP client, request factory and stream factory to use our library.

For your convenience we provide an adapter for Curl. To use it you have to enable PHP curl extension and install some HTTP helpers:

Example below shows how to make use of that adapter (pay attention to namespace Smsapi\Client\Curl):

If your are not willing to use Curl as HTTP client then you have to provide your own HTTP client, request factory and stream factory, as in example below (pay attention to namespace Smsapi\Client):

All following examples consider you have client well-defined in client.php file.

How to use SMSAPI.COM service?

How to use SMSAPI.PL service?

How to use SMSAPI.SE or SMSAPI.BG services?

How to use service business features?

All following examples consider you have an account on SMSAPI.COM and service has been setup in service.php file.

How to use ping feature?

How to send a SMS?

How to use request parameters?

Request parameters are represented in a form of data transfer object. DTOs can be found by searching for 'bag' postfixed classes. Each bag may contain required and optional parameters.

Required parameters

Required parameters are that class public properties, usually accessible via some form of a setter or named constructor. Each parameter can be also set directly by setting bag property, as in example:

How to change SMS encoding?

Optional parameters

Some of request's optional parameters have been described by docblock's '@property' annotation. You can always add any not documented here optional parameter by setting dynamic property to 'bag'. Camel case property names are being converted to snake case on the fly.

How to send a SMS with optional from field?

For more usage examples take a look at client test suite.

How to use additional features?

How to use proxy server?

To use proxy server you have to define it with your HTTP client.

How to log requests and responses?

Set logger to SmsapiHttpClient instance.

How to test package

Copy phpunit.dist.xml to phpunit.xml. You may adjust it to your needs then.

Copy tests-resources/config/config.dist.yml to tests-resources/config/config.yml. Fill in SMSAPI service connection data.

How to run unit tests

Unit tests are included into package build process and run against its current version on every commit (see workflow Tests). You can run those tests locally with ease using provided Docker configuration, simply run:

How to run integration tests

Note that integration test works within an account you have configured in tests-resources/config/config.yml. Although those test have been written to self-cleanup on exit, in case of failure some trash data may stay. Use it with caution.

How to run feature tests

Feature test groups are defined in phpunit.dist.xml. To run tests execute:

How to run tests against PHP8

To run any of mentioned above against PHP8 use make targets with php8 suffix. See Makefile.php8.

Docs & Infos


All versions of php-client with dependencies

PHP Build Version
Package Version
Requires php Version ^7 || ~8.0 || ~8.1 || ~8.2 || ~8.3
ext-json Version *
psr/log Version ^1 || ^2 || ^3
psr/http-message Version ~1.0 || ~1.1 || ~2.0
psr/http-client Version ^1
psr/http-factory Version ^1
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 smsapi/php-client contains the following files

Loading the files please wait ....