PHPackages                             mocean/client - 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. mocean/client

ActiveLibrary[API Development](/categories/api)

mocean/client
=============

PHP Client for using Mocean's API.

2.2.0(8mo ago)77.1k6[1 issues](https://github.com/MoceanAPI/mocean-sdk-php/issues)[1 PRs](https://github.com/MoceanAPI/mocean-sdk-php/pulls)2MITPHPPHP &gt;=5.5.0 &lt;7.1.0

Since Jun 26Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/MoceanAPI/mocean-sdk-php)[ Packagist](https://packagist.org/packages/mocean/client)[ RSS](/packages/mocean-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (10)Used By (2)

MoceanAPI Client Library for PHP
================================

[](#moceanapi-client-library-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/2da3b231f0ed1a3ff46a68cf8402afd40473809bb8e4a99dbf473b50dff76e73/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f6365616e2f636c69656e742e737667)](https://packagist.org/packages/mocean/client)[![Build Status](https://camo.githubusercontent.com/0142a17495d2de04f95727de45f4e62c39741ddb3052e1bc8d441b324f12e66b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f4d6f6365616e4150492f6d6f6365616e2d73646b2d7068702e737667)](https://travis-ci.com/MoceanAPI/mocean-sdk-php)[![codecov](https://camo.githubusercontent.com/53fc3660fea14559c49dd71f2bd04e527ccaa3e5d95e5d26fedfd0dd1bbb8a27/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f4d6f6365616e4150492f6d6f6365616e2d73646b2d7068702e737667)](https://codecov.io/gh/MoceanAPI/mocean-sdk-php)[![codacy](https://camo.githubusercontent.com/f689560f56cfe3331a9757c9163a2a400f7ad3fc059f78cd91db5a101a20cf27/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f67726164652f37613165393466316331656134306664626661333632656362626334623266332e737667)](https://app.codacy.com/project/MoceanAPI/mocean-sdk-php/dashboard)[![StyleCI](https://camo.githubusercontent.com/461bb467da7389ce2b52c8efcc31feff567db4995264a4bfd04bbee638aa2004/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3133383732343932312f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/138724921)[![License](https://camo.githubusercontent.com/135e7cd7f287d8807f2deb9bd648e1d10f593eb36e58887547d267fba3f8747f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6f6365616e2f636c69656e742e737667)](https://packagist.org/packages/mocean/client)[![Total Downloads](https://camo.githubusercontent.com/a7159ed62828797452d911debd40817f86d9d2f88c4693e44f6c27205b4f7083/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f6365616e2f636c69656e742e737667)](https://packagist.org/packages/mocean/client)

*This library requires a minimum PHP version of 5.5*

This is the PHP client library for use Mocean's API. To use this, you'll need a Mocean account. Sign up [for free at moceanapi.com](https://dashboard.moceanapi.com/register?medium=github&campaign=php-sdk).

- [Installation](#installation)
- [Usage](#usage)
- [Example](#example)

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

[](#installation)

To use the client library you'll need to have [created a Mocean account](https://dashboard.moceanapi.com/register?medium=github&campaign=php-sdk).

To install the PHP client library using Composer.

```
composer require mocean/client
```

Usage
-----

[](#usage)

If you're using composer, make sure the autoloader is included in your project's bootstrap file:

```
require_once "vendor/autoload.php";
```

### For version &gt;=2.2.0

[](#for-version-220)

There are 2 ways to connect to MoceanAPI
Option 1: Create a client with your API token

```
use Mocean\Client;
use Mocean\Client\Credentials\Basic;

$mocean = new Client(new Basic(['apiToken' => 'API_TOKEN_HERE']));
```

Option 2 (legacy): Create a client with your API key and secret

```
use Mocean\Client;
use Mocean\Client\Credentials\Basic;

$mocean = new Client(new Basic(['apiKey' => 'API_KEY_HERE', 'apiSecret' => 'API_SECRET_HERE']));
```

### For version &lt;2.2.0

[](#for-version-220-1)

Create a client with your API key and secret:

```
use Mocean\Client;
use Mocean\Client\Credentials\Basic;

$mocean = new Client(new Basic('API_KEY_HERE', 'API_SECRET_HERE'));
```

Example
-------

[](#example)

To use [Mocean's SMS API](https://moceanapi.com/docs/?php#send-sms) to send an SMS message, call the `$mocean->message()->send();` method.

The API can be called directly, using a simple array of parameters, the keys match the [parameters of the API](https://moceanapi.com/docs/?php#send-sms).

```
$res = $mocean->message()->send([
    'mocean-to' => '60123456789',
    'mocean-from' => 'MOCEAN',
    'mocean-text' => 'Hello World'
]);

echo $res;
```

### Responses

[](#responses)

For your convenient, the API response data can be accessed either using php `object` style or `array` style

```
echo $res;            //show full response string
echo $res['status'];  //show response status, '0' in this case
echo $res->status;    //same as above
```

Documentation
-------------

[](#documentation)

Kindly visit [MoceanApi Docs](https://moceanapi.com/docs/?php) for more usage

License
-------

[](#license)

This library is released under the [MIT License](LICENSE)

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance60

Regular maintenance activity

Popularity30

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 61.1% 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.

###  Release Activity

Cadence

Every ~440 days

Recently: every ~656 days

Total

7

Last Release

242d ago

Major Versions

1.0.2 → 2.0.02019-06-14

PHP version history (3 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP &gt;=5.5.0

2.1.1PHP &gt;=5.5.0 &lt;7.1.0

### Community

Maintainers

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

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

---

Top Contributors

[![lkloon123](https://avatars.githubusercontent.com/u/21114981?v=4)](https://github.com/lkloon123 "lkloon123 (66 commits)")[![d3no](https://avatars.githubusercontent.com/u/19152825?v=4)](https://github.com/d3no "d3no (32 commits)")[![koksianchong2](https://avatars.githubusercontent.com/u/177727818?v=4)](https://github.com/koksianchong2 "koksianchong2 (6 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (3 commits)")[![zed-mocean](https://avatars.githubusercontent.com/u/70882784?v=4)](https://github.com/zed-mocean "zed-mocean (1 commits)")

---

Tags

moceanapiphpsmssms-apisms-clientsms-messages

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mocean-client/health.svg)

```
[![Health](https://phpackages.com/badges/mocean-client/health.svg)](https://phpackages.com/packages/mocean-client)
```

###  Alternatives

[saippuakauppias/safe-browsing

Client to use Google's and Yandex Safe Browsing API (v4)

1020.2k](/packages/saippuakauppias-safe-browsing)

PHPackages © 2026

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