Download the PHP package calisero/calisero-php without Composer

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

Calisero PHP SMS API Library

Latest Version on Packagist tests PHPStan License Tests Total Downloads

Official PHP library for the Calisero transactional SMS API.

Send SMS messages, manage opt-outs for GDPR compliance, and monitor your accountβ€”all with a simple, type-safe PHP library that just works.

Features

Requirements

The library carries no runtime dependencies beyond those extensions, so it drops into any supported PHP version without a resolver conflict.

Installation

Install the library via Composer:

That's it! The library includes its own HTTP client implementation and requires no additional dependencies.

Getting Your API Key

To use this library, you'll need an API key from your Calisero account:

  1. Log in to your Calisero account at https://calisero.ro
  2. Navigate to the dashboard and go to the "API Keys" section
  3. Click "Add Key" to create a new API key
  4. Configure your key:
    • Give it a descriptive name (e.g., "Production App", "Development")
    • Set IP filters if needed for additional security
    • Choose appropriate permissions
  5. Copy your API key and store it securely

API Key Management

From the API Keys section in your dashboard, you can:

Security Note: Never commit API keys to version control. Use environment variables or secure configuration files.

Quick Start

Basic SMS Sending

Environment Configuration

For production applications, store your API key securely:

🎯 Common Use Cases

OTP/2FA Authentication

Order Notifications

Marketing Campaigns with Opt-out Compliance

Advanced Message Creation

PHP 7.4: named arguments need PHP 8.0. On PHP 7.4 pass the arguments in the constructor's order: recipient, body, visibleBody, validity, scheduleAt, callbackUrl, sender, shortenUrls (use null for the ones you skip).

sender must be one of the senders approved for your account (Messages > Senders in the dashboard), written exactly as approved: the match is case-sensitive. A sender that is unknown or not approved yet is refused with a ValidationException ("The sender is invalid or is not approved.") and nothing is sent; leave it out for the default sender. callbackUrl must be an http or https address on the public Internet: private, loopback and link-local addresses are refused, and redirects are not followed.

Authentication

Using API Key (Bearer Token)

Custom Authentication Provider

SmsClient::create() takes the API key itself. To authenticate through a provider like this one, build the HTTP client and the services yourself, as shown in Building the Client Yourself.

πŸ“š Examples

This library includes comprehensive examples for all operations. Check the examples/ directory for detailed usage patterns:

πŸ“± Message Examples

🚫 OptOut Examples (GDPR Compliance)

βœ… Verification Examples (OTP)

πŸ‘€ Account Examples

πŸ“¬ Webhook Examples

πŸ›‘οΈ Error Handling

πŸš€ Running Examples

  1. Clone this repository and install dependencies:

  2. Set your API key in any example file:

  3. Run an example:

Note: Examples use masked phone numbers (+40742***350) for security. Replace with actual phone numbers when testing.

API Reference

Messages

Send a Message

Shorten URLs

Set shortenUrls to true and Calisero replaces every http:// and https:// link of the body with a short one before sending, so the SMS gets shorter (and may take fewer parts). Each shortened link comes back with its click statistics:

Links are not shortened unless you ask: leave shortenUrls out (or pass false) and the body is sent as written.

Get Message Details

List Messages

Delete a Message

Verifications (OTP)

Create a Verification

The code is sent from a shared sender, so neither the brand nor a custom template (which must hold {code}) may contain links (web addresses, domains, emails or IP addresses): the API refuses them with a ValidationException.

Get Verification Details

List Verifications

Validate a Verification Code (OTP)

Opt-outs

Create an Opt-out

List Opt-outs

Update an Opt-out

Delete an Opt-out

Accounts

Get Account Information

Delivery Status Webhooks

When a message has a callbackUrl, Calisero posts a JSON payload to it each time the message's status changes (sent, delivered or undelivered). DeliveryWebhookMessage reads and validates it:

Only a failed connection or an answer slower than 2 seconds is retried (at most 5 attempts in total); a non-2xx answer is not. Keep the endpoint fast: record the status or queue a job, then answer. In a framework, pass the decoded request body to DeliveryWebhookMessage::fromArray() instead.

The callback URL must be reachable from the Internet: the API refuses private, loopback and link-local addresses (localhost, 192.168.x.x…) and does not follow redirects. To receive callbacks on a development machine, expose the endpoint through a public tunnel and use its URL.

Daily Sending Limit

Every account has its own daily sending limit: how many messages it can send in a day. A new account starts with a default limit and keeps it until Calisero raises it on request.

You can see the limit and what is left of it in three places:

Once the limit is reached, new messages and verifications are refused with a DailyLimitExceededException until midnight, Romania time. Nothing is sent and nothing is billed:

To raise the limit, contact Calisero with your account and the daily volume you expect.

Rate Limits & Trace ID

Request Rate Limit

Separately from the daily sending limit, each API user may make 240 requests a minute, on every endpoint. Above that the API answers 429 and the library throws a RateLimitedException:

DailyLimitExceededException extends RateLimitedException, so catch it first. After a successful create, getResponseMeta()->getRateLimitRemaining() tells how many requests are left in the current minute.

Trace ID

Every API answer carries the request's trace ID. Log it: quoting it to support lets Calisero find the request at once, and the dashboard shows everything that happened to it under Developers β†’ Debug.

Error Handling

The library provides specific exception types for different error scenarios:

Every ApiException carries the API's own error message (getMessage()), the HTTP status (getStatusCode()), the request's trace ID (getTraceId(); getRequestId() returns the same value) and the decoded error body (getErrorDetails()).

Exception When
UnauthorizedException 401: invalid or missing API key
ForbiddenException 403: not allowed, e.g. deleting a message already sent
NotFoundException 404: the resource does not exist
ValidationException 422: invalid request data; field errors in getValidationErrors()
DailyLimitExceededException 429: the account reached its daily sending limit
RateLimitedException 429: more than 240 requests a minute
ServerException 500, 502, 503, 504
ApiException Any other API error; base class of the above
TransportException The request got no answer (network error, timeout)

Advanced Configuration

Simple Client Creation

The library uses a simplified approach with built-in HTTP client:

The library uses an optimized cURL-based HTTP client internally, providing excellent performance without external dependencies.

SmsClient::create() sends every request to https://rest.calisero.ro/api/v1 with a 30-second timeout (10 seconds to connect), authenticates with the API key you pass, and adds a random UUID Idempotency-Key header to each message and verification it creates. Every request names the library, PHP and the platform in its User-Agent header, e.g. Calisero-SMS-PHP/2.3.2 (PHP 8.5.3; linux x86_64).

The API accepts TLS 1.2 and TLS 1.3 only: from 1 November 2026 a connection that offers only TLS 1.0 or 1.1 is refused during the handshake, before any request is read. The library never offers less than TLS 1.2, so it needs a cURL built with an SSL library that supports it (any OpenSSL from 1.0.1 on). If you build the client yourself, keep the https:// base URL: a request to http:// is redirected, and the library does not follow redirects.

Building the Client Yourself

SmsClient::create() is the only way to get an SmsClient, and its setup is fixed. For anything else (your own authentication or idempotency key provider, other timeouts, or the raw response to each request), build the HTTP client and the services yourself: every service takes the HttpClient in its constructor.

Custom Idempotency Key Provider

The library sends an Idempotency-Key header with each message and verification it creates, a random UUID by default. To generate the key yourself, implement IdempotencyKeyProviderInterface and pass your provider as the last argument of HttpClient:

Testing

The library includes comprehensive test coverage:

Testing Your Implementation

SmsClient::create() builds its own HTTP client, so let the code you want to test receive the service it uses, such as a MessageService: pass it $client->messages() in production. In tests, build the service on a mocked HttpClient that returns the API's JSON body, decoded:

The library's own service tests, in tests/Unit/Services, work the same way; TESTING.md describes the whole suite.

Contributing

Please see CONTRIBUTING.md for details on how to contribute to this project.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

License

This library is open-sourced software licensed under the MIT license.

Support

Changelog

Please see CHANGELOG.md for more information on what has changed recently.


All versions of calisero-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-json Version *
ext-curl Version *
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 calisero/calisero-php contains the following files

Loading the files please wait ...