Download the PHP package callr/sdk-php without Composer
On this page you can find all versions of the php package callr/sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download callr/sdk-php
More information about callr/sdk-php
Files in callr/sdk-php
Package sdk-php
Short Description CALLR PHP SDK for JSON-RPC API
License MIT
Homepage https://github.com/THECALLR/sdk-php
Informations about the package sdk-php
⚠️ DEPRECATED — Callr API v1 (JSON-RPC)
This SDK targets the legacy Callr JSON-RPC API (v1), which is deprecated and will be shut down on 30 June 2027. After that date this SDK will stop working.
➡️ Please migrate to the new Callr REST API v2.
- 📘 Migration guide (JSON-RPC → REST API v2): https://docs.callr.com/reference/migrating-from-json-rpc-v1
- 📣 What's new in REST API v2: https://docs.callr.com/changelog/rest-api-v2-is-here
- 🌐 REST API v2 base URL:
https://api.callr.com/v2.0- ✉️ Questions / migration help: [email protected]
Your existing API credentials work with REST API v2 — no new keys required.
Official Callr REST API v2 SDKs are coming in the near future. In the meantime, you can call the REST API directly, or generate a client from the OpenAPI 3.1 spec (see Generate a REST API v2 client today below).
Generate a REST API v2 client today
An official Callr REST API v2 SDK for PHP is coming soon. Until then, generate a fully-typed client from the OpenAPI 3.1 spec with OpenAPI Generator (requires v7.x+ for OpenAPI 3.1):
Authenticate with your API Key via the x-api-key header (or HTTP Basic: Account SID + API Key). The base URL https://api.callr.com/v2.0 is baked into the generated client — see its generated docs/ for the available endpoints.
PHP SDK for CALLR API
JSON-RPC 2.0 PHP class, to use with CALLR API.
- API documentation: http://www.callr.com/docs/
- SDK Installation guide: see INSTALLING.php.md
- Example projects: https://github.com/THECALLR/examples-php
-
JSON-RPC 2.0 Specification: http://www.jsonrpc.org/specification
- Easy to use Client class, built for PHP 5.4+
- Can be used for both the API and Real-time calls
- Requires:
php5-curl
Composer
You should use Composer (https://getcomposer.org/) to manage your PHP dependencies.
If you do not have a composer.json file yet, create one at the root of your project, download Composer, and launch composer update.
The composer.json file should look like this:
Add all the libraries you need in composer.json. Do not forget to run composer update each time you edit the file.
Then you just need to include one file in your code:
Usage
Init
Login-as
If you want to log in as another sub-customer or sub-user (one you have access
to), you can call the logAs method on the chosen authenticator :
Available authenticators are the classic login / password (sent through a BASIC http request) or the Api-Key. Both supports the Login-As feature.
Sending SMS
Without options
Method
Personalized sender
Your sender must have been authorized and respect the sms_sender format
Method
If you want to receive replies, do not set a sender - we will automatically use an SMS number
Method
Force GSM encoding
The default behaviour is to send your SMS with GSM 7-bit encoding. However, if your text contains a character that is not in the GSM 7-bit charset (Basic Character Set), we will send it as 16-bit UCS-2 (UNICODE) - using 2 bytes per character.
You can however force the encoding to be used at any time, using the force_encoding property.
If you force a GSM encoding, we will try to convert non-GSM characters to GSM ones. « becomes ", € becomes e, etc. The full mapping is available when calling the method sms.get_gsm_charset_mapping.
Please note that whatever the encoding forced or used, you always send your text as a JSON string to our API, without any special processing. The charset is applied in our platform before sending to the carriers.
Method
Objects
Long SMS (availability depends on carrier)
We automatically handle concatenated SMS. The number of SMS parts billed will be set on the parts property of the SMS object. The object can be sent to you using Webhooks.
If your SMS is GSM 7-bit encoded:
- If it's equals or less than 160 characters, it counts as 1 SMS.
- If it's more than 160 characters, the split is done every 153 characters.
If your SMS is UNICODE encoded:
- If it's equals or less than 70 characeters, it counts as 1 SMS.
- If it's more than 70 characters, the split is done every 67 characters.
Method
Specify your SMS nature (alerting or marketing)
Method
Objects
Custom data
Method
Objects
Delivery Notification - set URL to receive notifications
To receive delivery notifications (DLR), you have to subscribe to the webhook sms.mt.status_update (see below).
Method
Inbound SMS - set URL to receive inbound messages (MO) and replies
Do not set a sender if you want to receive replies - we will automatically use an SMS number.
To receive inbound messages (MO), you have to subscribe to the webhook sms.mo (see below).
Method
Get an SMS
Method
Objects
Webhooks
See our online documentation: http://www.callr.com/docs/webhooks/
Subscribe to webhooks
Method
Objects
List available webhooks
Method
REALTIME
Create a REALTIME app with a callback URL
App name format
Method
Objects
Start a REALTIME outbound call
Method
Objects
Inbound Calls - Assign a phone number to a REALTIME app
Method
Objects
DIDs
List available countries with DID availability
Method
Objects
Get area codes available for a specific country and DID type
Method
Objects
Get DID types available for a specific country
Method
Objects
Buy a DID (after a reserve)
Method
Objects
Cancel your order (after a reserve)
Method
Cancel a DID subscription
Method
View your store quota status
Method
Objects
Get a quote without reserving a DID
Method
*Objects/
Reserve a DID
Method
Objects
View your order
Method
Objects
Conferencing
Create a conference room
Method
Objects
Assign a DID to a room
Method
Create a PIN protected conference room
Method
Objects
Call a room access
Method
Media
List your medias
Method
Create an empty media
Method
Upload/Import a media
Method
Use Text-to-Speech
Method
CDR
Get inbound or outbound CDRs
Method
Objects
Broadcast messages to a target
Without options
Method
Objects
All versions of sdk-php with dependencies
ext-curl Version *
ext-json Version *