PHPackages                             greensms/greensms - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. greensms/greensms

ActiveLibrary[HTTP &amp; Networking](/categories/http)

greensms/greensms
=================

GREENSMS API: SMS, WhatsApp, Viber, VK, Voice, Call, HLR

v4.2.0(1y ago)2629.6k—1.1%9MITPHPPHP &gt;=7.3CI passing

Since Apr 2Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/greensms-io/greensms-php)[ Packagist](https://packagist.org/packages/greensms/greensms)[ Docs](https://github.com/greensms-ru/greensms-php)[ RSS](/packages/greensms-greensms/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (7)Used By (0)

greensms-php
============

[](#greensms-php)

[![GitHub release (latest by date)](https://camo.githubusercontent.com/d875ff7a564dbc721b86446ac8d3a5b9cdf0dcfa1e0d97cd31090fa274bf9e9b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f677265656e736d732d72752f677265656e736d732d706870)](https://camo.githubusercontent.com/d875ff7a564dbc721b86446ac8d3a5b9cdf0dcfa1e0d97cd31090fa274bf9e9b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f677265656e736d732d72752f677265656e736d732d706870)[![Packagist PHP Version Support](https://camo.githubusercontent.com/03d3a1063e15c7991c2da5dc7312f19357e18d2c4642b0643c261ec5f20304ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f677265656e736d732f677265656e736d73)](https://camo.githubusercontent.com/03d3a1063e15c7991c2da5dc7312f19357e18d2c4642b0643c261ec5f20304ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f677265656e736d732f677265656e736d73)[![Packagist Version](https://camo.githubusercontent.com/5cd12fd0b773b7efa8a85dfcc00c16c606f6c7ab0e53c930e91caa2089d3ffb7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f677265656e736d732f677265656e736d73)](https://camo.githubusercontent.com/5cd12fd0b773b7efa8a85dfcc00c16c606f6c7ab0e53c930e91caa2089d3ffb7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f677265656e736d732f677265656e736d73)[![PHP Composer](https://github.com/greensms-ru/greensms-php/actions/workflows/php.yml/badge.svg?event=release)](https://github.com/greensms-ru/greensms-php/actions/workflows/php.yml)

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

[](#documentation)

The documentation for the GREENSMS API can be found [here](https://api.greensms.io/).

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

[](#installation)

```
composer require greensms/greensms
```

Sample Usage
------------

[](#sample-usage)

Check out these [code examples](examples) to get up and running quickly.

```
use GreenSMS\GreenSMS;

# Register at my.greeensms.ru first
$client = new GreenSMS([
  'user' => 'test',
  'pass' => 'test'
]);

$response = $client->sms->send([
  'to' => '79260000121',
  'txt' => 'Here is your message for delivery'
]);

echo "Sms Request Id: " . $response->request_id;
```

### Environment Variables

[](#environment-variables)

`greensms-php` supports credential storage in environment variables. If no credentials are provided following env vars will be used: `GREENSMS_USER`/`GREENSMS_PASS` OR `GREENSMS_TOKEN`.

### Token Auth

[](#token-auth)

```
use GreenSMS\GreenSMS;

$tokenClient = new GreenSMS([
  'token' => 'yourtoken'
]);

$response = $tokenClient->account->balance();
echo "Balance : " . $response->balance. "\n";
```

Compatibility
-------------

[](#compatibility)

`greensms-php` is compatible with PHP 7.3+ onwards until the latest PHP Version

Methods
-------

[](#methods)

- You can either use username/password combination or auth token to create an object with constructor
- Each API Function is available as `MODULE.FUNCTION()`
- Parameters for each API can be referred from [here](https://api.greensms.io/)
- Response keys by default are available in `snake_case`. If you want to use `camelCase`, then pass `'camelCaseResponse'= > true`, in the constructor

Handling Exceptions
-------------------

[](#handling-exceptions)

- Exceptions for all APIs are thrown with RestException class. It extends the default PHP Exception class.
- Each error, will have a message and code similar to PHP Exceptions.
- In case of *Validation Error*, additional params are available to show field-wise rule failures. Can be accessed by `$e->getParams()` method on the error object

Getting help
------------

[](#getting-help)

If you need help installing or using the library, please contact us: .

If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!

Contributing
------------

[](#contributing)

Bug fixes, docs, and library improvements are always welcome. Please refer to our [Contributing Guide](CONTRIBUTING.md) for detailed information on how you can contribute. If you're not familiar with the GitHub pull request/contribution process, [this is a nice tutorial](https://gun.io/blog/how-to-github-fork-branch-and-pull-request/).

### Getting Started

[](#getting-started)

If you want to familiarize yourself with the project, you can start by [forking the repository](https://help.github.com/articles/fork-a-repo/) and [cloning it in your local development environment](https://help.github.com/articles/cloning-a-repository/). The project requires [Node.js](https://nodejs.org) to be installed on your machine.

After cloning the repository, install the dependencies by running the following command in the directory of your cloned repository:

```
composer require
```

GreenSMS has all the unit tests defined under **tests** folder with `*Test.php` extension. It uses PHPUnit, which is added as a dev dependency. You can run all the tests using the following command.

```
./vendor/bin/phpunit tests
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance56

Moderate activity, may be stable

Popularity40

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79% 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 ~298 days

Recently: every ~373 days

Total

6

Last Release

379d ago

Major Versions

v1.7.0 → v2.0.02023-04-04

v2.0.1 → v4.0.02024-07-24

PHP version history (3 changes)v1.6.4PHP &gt;=5.3.2

v2.0.0PHP &gt;=7.0

v4.0.0PHP &gt;=7.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2344130?v=4)[greensms](/maintainers/greensms)[@greensms](https://github.com/greensms)

---

Top Contributors

[![mananjadhav](https://avatars.githubusercontent.com/u/3069065?v=4)](https://github.com/mananjadhav "mananjadhav (94 commits)")[![2naive](https://avatars.githubusercontent.com/u/1451033?v=4)](https://github.com/2naive "2naive (12 commits)")[![andSemin](https://avatars.githubusercontent.com/u/22003030?v=4)](https://github.com/andSemin "andSemin (8 commits)")[![someAction](https://avatars.githubusercontent.com/u/176392055?v=4)](https://github.com/someAction "someAction (4 commits)")[![starinacool](https://avatars.githubusercontent.com/u/221450?v=4)](https://github.com/starinacool "starinacool (1 commits)")

---

Tags

2fa-codescall-for-codesmssms-apisms-notificationssms-verificationviber-apiapirestsmsvibergreensms

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[infobip/infobip-api-php-client

PHP library for consuming Infobip's API

921.8M10](/packages/infobip-infobip-api-php-client)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)

PHPackages © 2026

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