HonkIO SDKs for Python, PHP and Laravel
Official HonkIO SDKs for Python and PHP are out, along with a Laravel package that sends your mail and SMS notifications through HonkIO.
Until today, if you were not writing JavaScript, using HonkIO meant writing your own HTTP calls. Now there are official SDKs for Python and PHP, and a package for Laravel. They cover the same API as @honkio/node: SMS, email, CASL consent, phone numbers, verification codes and webhooks.
Python
honkio on PyPI runs on Python 3.10 or newer and comes with a regular client and an async one.
pip install honkioimport os
from honkio import Honkio
client = Honkio(os.environ["HONKIO_API_KEY"])
# "from_" is one of your HonkIO numbers; "to" is a real number you hold consent for
message = client.messages.send(
from_="+1416XXXXXXX",
to="+1613XXXXXXX",
body="Hello from HonkIO! 🇨🇦",
)
print(message["id"], message["status"])PHP
honkio/honkio-php on Packagist runs on PHP 8.2 or newer.
composer require honkio/honkio-php<?php
use Honkio\Honkio;
$honkio = new Honkio(getenv('HONKIO_API_KEY'));
// "from" is one of your HonkIO numbers; "to" is a real number you hold consent for
$message = $honkio->messages->send([
'from' => '+1416XXXXXXX',
'to' => '+1613XXXXXXX',
'body' => 'Hello from HonkIO! 🇨🇦',
]);
echo $message['id'], ' ', $message['status'], "\n";In both languages an API error is an exception you can catch, with the same error codes the API documents.
Laravel
honkio/laravel is for Laravel 12 and 13. It adds a honkio mail transport, so the Mailables you already have send through HonkIO, and a honkio notification channel for SMS:
composer require honkio/laravel<?php
use Honkio\Laravel\Notifications\HonkioMessage;
use Illuminate\Notifications\Notification;
class ShipmentSent extends Notification
{
public function via($notifiable): array
{
return ['honkio'];
}
public function toHonkio($notifiable): HonkioMessage
{
return HonkioMessage::create('Your order has shipped.')
->from('+14165550100'); // optional, defaults to HONKIO_SMS_FROM
}
}Where to go next
The SDK guide at honkio.ca/docs/sdk has a section for each: Python, PHP and Laravel. Start with a test key, which delivers and charges nothing. The PHP and Laravel source is on GitHub at somecorp-dev/honkio-php and somecorp-dev/honkio-laravel, and issues are welcome there.
HonkIO