PHPackages                             smartpings/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. smartpings/php-sdk

ActiveLibrary[API Development](/categories/api)

smartpings/php-sdk
==================

Smartpings Messaging Service

01.2k↑75%1PHPCI passing

Since Jul 19Pushed 8mo agoCompare

[ Source](https://github.com/smartpingshq/php-sdk)[ Packagist](https://packagist.org/packages/smartpings/php-sdk)[ RSS](/packages/smartpings-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (1)

SmartPings PHP SDK
==================

[](#smartpings-php-sdk)

This is the official PHP SDK for the SmartPings API.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require smartpings/php-sdk
```

Getting Started
---------------

[](#getting-started)

The easiest way to use the service is by using the static `create` method. This will automatically set up the required HTTP client for you.

```
use Smartpings\Messaging\SmartpingsService;

// Instantiate the service with your credentials
$service = SmartpingsService::create(
    'your-client-id',
    'your-secret-id'
);

// Now you can use the service methods
```

Available Methods
-----------------

[](#available-methods)

### Send an SMS

[](#send-an-sms)

The `sendSms` method can send a message to a single phone number or an array of phone numbers.

```
// Send to a single recipient
$response = $service->sendSms('Your message here', 'recipient-phone-number');

// Send to multiple recipients
$response = $service->sendSms('Your message here', [
    'recipient-1-phone-number',
    'recipient-2-phone-number',
]);

if ($response->getStatusCode() === 200) {
    echo "SMS sent successfully!";
}
```

### Contact Verification

[](#contact-verification)

#### Generic Verification Method

[](#generic-verification-method)

The `verifyContact` method handles both phone and email verification:

```
// Send verification codes
$service->verifyContact('phone', '+15551234567');
$service->verifyContact('email', 'user@example.com');

// Verify with codes
$service->verifyContact('phone', '+15551234567', 'user-provided-code');
$service->verifyContact('email', 'user@example.com', 'verification-token');

// With additional options
$service->verifyContact(
    type: 'email',
    contact: 'user@example.com',
    code: null,
    name: 'John Doe',
    redirectUrl: 'https://yourapp.com/verify',
    expirationMinutes: 15,
    promoteToListIds: [1, 2, 3]
);
```

#### Convenience Methods

[](#convenience-methods)

For cleaner, type-specific verification:

```
// Phone verification
$service->sendPhoneVerification('+15551234567', 'John Doe');
$service->verifyPhoneWithCode('+15551234567', '123456');

// Email verification
$service->sendEmailVerification('user@example.com', 'John Doe');
$service->verifyEmailWithCode('user@example.com', 'verification-token');
```

#### Check Verification Status

[](#check-verification-status)

Monitor verification status for any contact:

```
$response = $service->getContactVerificationStatus('user@example.com');

if ($response->getStatusCode() === 200) {
    $data = json_decode($response->getBody()->getContents(), true)['data'];

    // Status: 'pending', 'verified', or 'expired'
    echo "Status: {$data['status']}, Verified: " . ($data['verified'] ? 'Yes' : 'No');
}
```

Advanced Usage
--------------

[](#advanced-usage)

If you need to customize the HTTP client (e.g., to add custom middleware, logging, or timeout settings), you can instantiate the `SmartpingsService` manually by passing any PSR-18 compatible client and PSR-17 compatible factories.

```
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\HttpFactory;
use Smartpings\Messaging\SmartpingsService;

// 1. Create a PSR-18 HTTP Client
$client = new Client(['timeout' => 5.0]);

// 2. Create a PSR-17 Factory
$httpFactory = new HttpFactory();

// 3. Instantiate the service
$service = new SmartpingsService(
    $client,          // Your custom client
    $httpFactory,     // Request factory
    $httpFactory,     // Stream factory
    'https://api.smartpings.com/api/', // API URL
    'your-client-id',
    'your-secret-id'
);

// The service is ready to use
$response = $service->sendSms('Your message here', 'recipient-phone-number');
```

Laravel Integration
-------------------

[](#laravel-integration)

This package includes a service provider for seamless integration with Laravel.

### How It Works

[](#how-it-works)

The package will automatically register a service provider that instantiates the `SmartpingsService` for you. The provider uses the static `create()` method and configures it with the credentials you set in your `.env` file.

This allows you to inject the `SmartpingsService` directly into your controllers or other services, and it will be ready to use.

### Configuration

[](#configuration)

1. **Add your credentials to your `.env` file:**

    ```
    SMARTPINGS_CLIENT_ID=your-client-id
    SMARTPINGS_SECRET_ID=your-secret-id
    ```
2. **Publish the configuration file (optional):**

    If you need to customize the API URL or other settings, you can publish the configuration file:

    ```
    php artisan vendor:publish --provider="Smartpings\Messaging\SmartpingsServiceProvider"
    ```

    This will create a `config/smartpings.php` file in your application.

### Usage Example

[](#usage-example)

Once configured, you can inject the `SmartpingsService` anywhere in your Laravel application.

```
use Smartpings\Messaging\SmartpingsService;

class YourController
{
    public function __construct(private SmartpingsService $smartpingsService)
    {
    }

    public function sendMessage()
    {
        $response = $this->smartpingsService->sendSms(
            'Your message here',
            'recipient-phone-number'
        );

        if ($response->getStatusCode() === 200) {
            // Message sent successfully
        }
    }
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance43

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1ca6f6e01ecbfe6640ff410c4f0321054fb48d05a5f843c2b89887b90369bcd?d=identicon)[whilesmart](/maintainers/whilesmart)

---

Top Contributors

[![nfebe](https://avatars.githubusercontent.com/u/14317775?v=4)](https://github.com/nfebe "nfebe (10 commits)")

---

Tags

apipush-notificationssmsverificationwhatsapp-notification

### Embed Badge

![Health badge](/badges/smartpings-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/smartpings-php-sdk/health.svg)](https://phpackages.com/packages/smartpings-php-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
