Download the PHP package nikba/sms.md-php-api without Composer

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

sms.md PHP SDK

Latest Version Tests PHP Version Total Downloads

Modern PHP SDK for the sms.md v3 Client API — send single, bulk and one‑time‑code (OTP) SMS in Moldova, estimate cost, read delivery history, manage address books and check your balance.

📖 Changelog

Upgrading from 1.x? The v1 API this SDK used is now legacy. 2.0 is a rewrite around v3 with new method names and exception‑based error handling. See Migration.

Installation

The SDK talks to any PSR‑18 HTTP client. If you don't already have one, install Guzzle (it will be discovered automatically):

Quick start

  1. Create an API token in your account: Settings → API (https://app.sms.md/settings/api).
  2. Register and get approval for a sender name: Settings → Sender names.
  3. Send:

A token grants full access to the account and can spend your balance — keep it server‑side, never in mobile apps or frontend code.

Usage

Send an SMS

Recommended number format is national with no prefix (69123456). 069123456, 37369123456, +37369123456 and forms with spaces/dashes are accepted too.

Bulk send (up to 500 recipients)

Estimate cost before sending

One‑time codes (OTP)

Read messages

Supported listMessages filters: dateCreated[after], dateCreated[before], dateSent[after], dateSent[before], senderName, receiverNumber, status, order[desc].

Sender names

Address books & contacts

International sending

There is no separate method or parameter for foreign numbers — pass an international number to the same sendMessage() / sendBulk() / estimate() calls and the API detects the destination automatically. +373 77… (Transnistria) and any non‑Moldovan number count as international.

International sending must be enabled for your account (and may be restricted to specific countries). The response tells you the destination and country:

If international sending is disabled, a single send throws ValidationException with the reason under the _ key (not tied to a field):

In a bulk send, disallowed numbers are skipped individually rather than failing the whole batch — the rest still go out:

Use estimate() first to see the segment count and per‑country price without sending.

Balance

Error handling

Every failed request throws a typed exception. Branch on the machine‑readable code, never on the message — in production the message is replaced with a generic string.

Exception Error code(s) HTTP
AuthenticationException AUTHENTICATION_REQUIRED, INVALID_API_TOKEN 401
InsufficientBalanceException INSUFFICIENT_BALANCE 402
ForbiddenException FORBIDDEN, SCOPE_FORBIDDEN 403
NotFoundException NOT_FOUND 404
ValidationException VALIDATION_ERROR 422
RateLimitException RATE_LIMIT_EXCEEDED 429
ServerException INTERNAL_ERROR 5xx
TransportException — (network / non‑JSON response) —

All of the above extend SmsMdException, so you can catch that to handle any SDK failure at once.

Scopes

Each API token is created with a set of scopes; an endpoint whose scope the token lacks fails with 403 SCOPE_FORBIDDEN. Relevant scopes: messages:send, messages:read, otp:send, contacts:read, contacts:write, senders:read, account:read.

Billing

You're charged per segment. A single Cyrillic character switches the whole message to UCS‑2 (70 chars/segment instead of 160). Use estimate() or the Encoding enum to reason about segment sizes:

Injecting your own HTTP client

Any PSR‑18 client and PSR‑17 factories can be passed explicitly — useful for custom timeouts, retries, proxies or testing:

Legacy v1 API

The deprecated v1 endpoints remain reachable for backward compatibility:

Migration from 1.x

1.x 2.0
$sms->sendSms($to, $msg, $from) $sms->sendMessage($to, $text, $from)
$sms->getBalance() → int $sms->getBalance() → string
$sms->getMessages($page, $from, $to, $status) $sms->listMessages($filters, $page) (returns data + meta)
$sms->getMessage($id) $sms->getMessage($id)
$sms->getMessageStatuses() $sms->messageStatuses()
$sms->getSenderAliases() $sms->listSenderAliases()
$sms->getContacts() / getAddressBooks() $sms->listAddressBookContacts() / listAddressBooks()
errors returned in the payload typed exceptions thrown

Auth moved from a ?token= query parameter to the X-Api-Token header, and sends are now POST … /v3/messages with a JSON body. Responses are wrapped in a {status, data, meta} envelope, which the SDK unwraps for you.

Testing

License

MIT — Free Software, Hell Yeah!


All versions of sms.md-php-api with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
php-http/discovery Version ^1.19
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 nikba/sms.md-php-api contains the following files

Loading the files please wait ...