1. Go to this page and download the library: Download kirimi/kirimi-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kirimi / kirimi-php example snippets
irimi\KirimiClient;
$client = new KirimiClient('YOUR_USER_CODE', 'YOUR_SECRET_KEY');
$client = new KirimiClient($userCode, $secret, $endpoint = 'https://api.kirimi.id');
// Text message only
$result = $client->sendMessage('device_id', '628123456789', 'Hello World!');
// Message with media
$result = $client->sendMessage(
'device_id',
'628123456789',
'Check out this image!',
'https://example.com/image.jpg'
);
// In your Laravel service provider or controller
use Kirimi\KirimiClient;
class WhatsAppService
{
private KirimiClient $kirimi;
public function __construct()
{
$this->kirimi = new KirimiClient(
config('services.kirimi.user_code'),
config('services.kirimi.secret')
);
}
public function sendNotification(string $phone, string $message): bool
{
try {
$this->kirimi->sendMessage(
config('services.kirimi.device_id'),
$phone,
$message
);
return true;
} catch (KirimiException $e) {
Log::error('WhatsApp notification failed: ' . $e->getMessage());
return false;
}
}
}
// In config/services.php
return [
'kirimi' => [
'user_code' => env('KIRIMI_USER_CODE'),
'secret' => env('KIRIMI_SECRET_KEY'),
'device_id' => env('KIRIMI_DEVICE_ID'),
],
];
use Kirimi\KirimiException;
try {
$client->sendMessage('device_id', 'invalid_number', 'Hello');
} catch (KirimiException $e) {
$errorMessage = $e->getMessage();
if (strpos($errorMessage, 'Parameter tidak lengkap') !== false) {
echo 'Missing
// Good practice: use environment variables
$client = new KirimiClient(
$_ENV['KIRIMI_USER_CODE'],
$_ENV['KIRIMI_SECRET_KEY']
);
bash
composer
bash
# Set your credentials as environment variables
export KIRIMI_USER_CODE="your_user_code"
export KIRIMI_SECRET_KEY="your_secret_key"
export KIRIMI_DEVICE_ID="your_device_id"
export TEST_PHONE="628123456789"
# Run the example
composer run example
# or
php examples/demo.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.