Download the PHP package sendimessage/sdk without Composer

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

SendiMessage SDK for PHP

Version PHP

The official PHP client for the SendiMessage API — send and receive iMessage and SMS programmatically. No dependencies beyond ext-curl and ext-json.

Server-side only. The API key pair grants full messaging access to your account — never expose it in front-end code.

Contents

Requirements

Installation

Authentication

Create a key pair in the account portal under API credentials. You get a key_id and a secret — the secret is shown once, store it securely (e.g. in your secret manager or environment variables). Every request the SDK makes carries them as the X-API-Key / X-API-Secret headers.

You can verify a key pair at any time with GET /me (curl example in the account portal).

Quick start

The API delivers over iMessage first and falls back to SMS when the recipient is not reachable over iMessage.

Usage

Sending messages

If your account has more than one line (sending number), route via a specific one with lineHandle:

Sending media

Upload the file first — uploadMedia returns a public URL you pass as mediaUrl. Images, video, audio and PDF are supported, up to 50 MiB.

content is optional when mediaUrl is set; provide both to send a caption with the attachment. Any public http(s) URL also works as mediaUrl.

Scheduling and status callbacks

Message status and history

Every send returns a message_handle. Poll it — or better, use a webhook / statusCallback:

History is cursor-paginated: pass next_before from one page as before on the next. next_before is null on the last page.

Filters: number, direction (in / out), line_handle, conversation_handle, service, since, until, limit.

iMessage lookup

Check whether a number is reachable over iMessage before sending:

Lookups are answered by a live Apple device, so the API is cache-first: a fresh cached answer returns immediately, otherwise the question is queued and the call waits briefly for a device. If no answer arrives in time you get a pending response — retry shortly; a 503 means no device is currently online for your account.

Contacts and opt-out

Contacts are your address book: names shown in conversations, the detected service (iMessage/SMS) and the opt-out flag.

Opt-out is enforced on every send path — a send to an opted-out number fails with HTTP 422. Inbound STOP / UNSUBSCRIBE / CANCEL / END / QUIT opts the sender out automatically; START / UNSTOP / YES opts back in. You can also manage it explicitly:

Lines and call forwarding

A line is a sending identity (phone number or iMessage address) on your account.

Calls to your line's number can be forwarded to any number you choose. Forwarding is configured by the SendiMessage operator, so changes are asynchronous — the API answers 202 and the request shows as pending until fulfilled:

Conversations

Conversations group the message history per contact:

Webhooks

Get pushed events instead of polling. Events:

Event Fired when
receive An inbound message arrives
outbound An outbound message reaches its final status (sent/failed)
line_blocked A line was blocked by Apple (sends answer 422 until unblocked)
line_unblocked The block was lifted

When the webhook has a secret, every delivery carries an X-SMSBridge-Signature header — the hex HMAC-SHA256 of the raw request body. Always verify it:

Error handling

Every non-2xx response throws SendImessage\ApiException with the HTTP code as getCode(), the API error text as getMessage(), and the parsed response body on the body property.

Common statuses:

Status Meaning
401 Bad or missing key pair
404 Unknown handle (message, contact, line, conversation)
422 Validation failed — including sends to an opted-out contact or via a blocked line
429 Rate limited — back off and retry
503 Lookup: no device online for your account

Configuration

API reference

Method Endpoint
sendMessage(number, content?, mediaUrl?, lineHandle?, statusCallback?, scheduledAt?) POST /send-message
getStatus(messageHandle) GET /status
listMessages(filters?) GET /v2/messages
getMessage(messageHandle) GET /v2/messages/{handle}
uploadMedia(path, filename?) POST /media
lookup(number) GET /lookup
listContacts(params?) GET /contacts
createContact(props) POST /contacts
getContact(number) GET /contacts/{number}
updateContact(number, props) PUT /contacts/{number}
deleteContact(number) DELETE /contacts/{number}
setOptOut(number, optedOut?) POST /contacts/opt-out
recheckContact(number) POST /contacts/{number}/lookup
listLines() GET /lines
updateLine(lineHandle, label?, isActive?) PUT /lines/{handle}
getCallForwarding(lineHandle) GET /lines/{handle}/call-forwarding
setCallForwarding(lineHandle, forwardingNumber) PUT /lines/{handle}/call-forwarding
listConversations(params?) GET /conversations
listConversationMessages(handle, params?) GET /conversations/{handle}/messages
markConversationRead(handle) POST /conversations/{handle}/read
listWebhooks() GET /account/webhooks
createWebhook(url, events?, secret?) POST /account/webhooks
replaceWebhooks(webhooks) PUT /account/webhooks
deleteWebhook(url) DELETE /account/webhooks

Full HTTP-level reference: the Postman collection.

License

MIT

Forcing SMS

By default the Mac tries iMessage and falls back to SMS when Apple reports the number has no iMessage. Pass service: 'sms' to send a plain text message straight away (or 'imessage' to insist on the default path):

$client->me() returns the user + company behind the key pair — the cheapest way to verify credentials.


All versions of sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json 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 sendimessage/sdk contains the following files

Loading the files please wait ...