PHPackages                             markenwerk/goyyamobile - 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. markenwerk/goyyamobile

Abandoned → [chroma-x/goyyamobile](/?search=chroma-x%2Fgoyyamobile)Library

markenwerk/goyyamobile
======================

Simple API abstraction for sending single SMS via Goyya Mobile.

4.0.2(5y ago)147[1 issues](https://github.com/chroma-x/php-goyyamobile/issues)MITPHPPHP &gt;=5.3

Since Apr 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/chroma-x/php-goyyamobile)[ Packagist](https://packagist.org/packages/markenwerk/goyyamobile)[ Docs](http://chroma-x.de/)[ RSS](/packages/markenwerk-goyyamobile/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (5)Versions (16)Used By (0)

PHP Goyya Mobile simple API
===========================

[](#php-goyya-mobile-simple-api)

[![Build Status](https://camo.githubusercontent.com/672a561df6c3fb9b9d7998cde59b24e2d78656bd424c3d2d6380f02076a3f7b8/68747470733a2f2f7472617669732d63692e6f72672f6368726f6d612d782f7068702d676f7979616d6f62696c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/chroma-x/php-goyyamobile)[![Test Coverage](https://camo.githubusercontent.com/703d8977a64b494e8a3c9ec3ace251dd4f681fd82548b52af162aa04701c36d9/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6368726f6d612d782f7068702d676f7979616d6f62696c652f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/chroma-x/php-goyyamobile/coverage)[![Dependency Status](https://camo.githubusercontent.com/b51910d5f2b36c1d801cd11764ae1c8dc7cc93984d485894d1d7f1124e9642f5/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537316637383435666364313961303034353434323334392f62616467652e737667)](https://www.versioneye.com/user/projects/571f7845fcd19a0045442349)[![SensioLabs Insight](https://camo.githubusercontent.com/6c747efa13b9f95d56d92986916d8be89d16c4f610888bc2f5ced3d734896992/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f32613662303732612d303337332d343665362d623666342d3130666339326363393166622e737667)](https://insight.sensiolabs.com/projects/2a6b072a-0373-46e6-b6f4-10fc92cc91fb)[![Code Climate](https://camo.githubusercontent.com/d35c3512e79e71041e967d07c916062ae7286e77fa9f0c04df82afeabe561b0a/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6368726f6d612d782f7068702d676f7979616d6f62696c652f6261646765732f6770612e737667)](https://codeclimate.com/github/chroma-x/php-goyyamobile)[![Latest Stable Version](https://camo.githubusercontent.com/6544e55be82ec8022ea040547d0ae016ce5914065b8a0c108509324c32b14a86/68747470733a2f2f706f7365722e707567782e6f72672f6368726f6d612d782f676f7979616d6f62696c652f762f737461626c65)](https://packagist.org/packages/chroma-x/goyyamobile)[![Total Downloads](https://camo.githubusercontent.com/f2efa50930f032771c92c499e25ebaaf58b2a3a41b07bb2f53badba8bb592ef9/68747470733a2f2f706f7365722e707567782e6f72672f6368726f6d612d782f676f7979616d6f62696c652f646f776e6c6f616473)](https://packagist.org/packages/chroma-x/goyyamobile)[![License](https://camo.githubusercontent.com/20ce8129bd900a92f4e6c9bc16acae05110568115baec59ad3228cef0308a2bf/68747470733a2f2f706f7365722e707567782e6f72672f6368726f6d612d782f676f7979616d6f62696c652f6c6963656e7365)](https://packagist.org/packages/chroma-x/goyyamobile)

Simple API abstraction for sending single short messages via [Goyya Mobile](https://www.goyya.com).

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

[](#installation)

```
{
   	"require": {
        "chroma-x/goyyamobile": "~4.0"
    }
}

```

Usage
-----

[](#usage)

### Autoloading and namesapce

[](#autoloading-and-namesapce)

```
require_once('path/to/vendor/autoload.php');

```

---

### Sending a single short message

[](#sending-a-single-short-message)

#### API Client authentication

[](#api-client-authentication)

Authentication against the Goyya Mobile webservice requires a valid account ID and password or a valid auth token.

##### API Client authentication by account credentials

[](#api-client-authentication-by-account-credentials)

```
$shortMessage = new ChromaX\GoyyaMobile\Message();
$shortMessage
	->setAccountId('GOYYA_ACCOUNT_ID')
	->setAccountPassword('GOYYA_ACCOUNT_PASSWORD');

```

##### API Client authentication by auth token

[](#api-client-authentication-by-auth-token)

```
$shortMessage = new ChromaX\GoyyaMobile\Message();
$shortMessage->setAuthToken('GOYYA_AUTH_TOKEN');

```

#### Debug mode

[](#debug-mode)

If you enable the debug mode your messages will get submitted to your Goyya Mobile provider, but not transmitted to the receiver.

> By default the debug mode is disabled.

```
$shortMessage->setDebugMode(true);

```

#### Preparing the message meta data

[](#preparing-the-message-meta-data)

Settings up the meta data requires the following properties.

- The receivers mobile number in international format, f.e. `+4915112345678`
- The senders name or mobile number in international format. Sender information should contain characters \[a-z,A-Z,0-9\] without whitepace only. Mobile numbers are allowed up to a length of 16 digits whith leading `00`. Sender names are allowed up to a length of 11 bytes.
- If you want to delay the submission of the short message to a specific time, you can set the desired time by calling `setSubmissionDate(YOUR_DESIRED_TIMESTAMP)`method and enable the delayed submission by calling `setDelayedSubmission(true)`.
- If your account is not bound to a specific plan, you can choose the plan you want to use (and pay) message wise. Call the `setSubmissionPlan` method with one of the following class constants as argument.
    - `ChromaX\GoyyaMobile\Message::PLAN_BASIC`
    - `ChromaX\GoyyaMobile\Message::PLAN_ECONOMY`
    - `ChromaX\GoyyaMobile\Message::PLAN_QUALITY`

> **Attention:** Check your plan to make sure you are allowed to send short messages using a name instead of a mobile number.
> By default the delayed submission if disabled.
> The default plan is `ChromaX\GoyyaMobile\Message::PLAN_BASIC`.

```
$shortMessage
	->setReceiver('RECEIVER_MOBILE_NUMBER')
	->setSender('SENDER_NAME_OR_MOBILE_NUMBER')
	->setDelayedSubmission(true)
	->setSubmissionDate(strtotime('+6 hours'))
	->setSubmissionPlan(ChromaX\GoyyaMobile\Message::PLAN_QUALITY);

```

#### Setting up the message content

[](#setting-up-the-message-content)

The message content is set up by configuring the message type and content.

- The message type defines how the content is handled. Call the `setMessageType` method with one of the following class constants to control how the messages content should get delivered.
    - `ChromaX\GoyyaMobile\Message::MESSAGE_TYPE_TEXT_SMS` allows sending 160 bytes. Setting content above this range throws an `ChromaX\GoyyaMobile\Exception\InvalidArgumentException`.
    - `ChromaX\GoyyaMobile\Message::MESSAGE_TYPE_OVERLONG_SMS` allows sending more than 160 bytes. If neccessary the content is submitted in multiple messages.
    - `ChromaX\GoyyaMobile\Message::MESSAGE_TYPE_UTF8_SMS` allows sending more than 160 bytes of unicode characters.
- The message content is handled as defined by `setMessageType`.

> The default message type is `ChromaX\GoyyaMobile\Message::MESSAGE_TYPE_TEXT_SMS`.
> Check the [GSM 7-bit default alphabet](https://en.wikipedia.org/wiki/GSM_03.38#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_.2F_GSM_03.38) to make sure your content will be displayed as expected at the receivers phone.

```
$shortMessage
	->setMessageType(ChromaX\GoyyaMobile\Message::MESSAGE_TYPE_OVERLONG_SMS)
	->setMessage('Curabitur blandit tempus porttitor. ÄÖÜß~');

```

#### Submitting the message

[](#submitting-the-message)

The message gets submitted by calling the `submit` method.

```
$shortMessage->submit();

```

#### Getting information about the submission

[](#getting-information-about-the-submission)

After a successful submission the Goyya Mobile message ID and the effective number of messages submitted are available.

```
$messageId = $shortMessage->getMessageId();
$messageCount = $shortMessage->getMessageCount();

```

Exception handling
------------------

[](#exception-handling)

Goyya Mobile simple API provides different types of exceptions.

- `\InvalidArgumentException` is thrown on calling a setter with an invalid argument.
- `ChromaX\CommonException` sub class exceptions get thrown if requesting the webservice of your Goyya Mobile provider fails for any reason.

You can find more information about [PHP Common Exceptions at Github](https://github.com/chroma-x/php-common-exceptions).

All exceptions have a specific code to allow you to handle the exceptions properly.

ExceptionCodeDescription\\InvalidArgumentException10Receiver is no valid international mobile number; starts not with `+` or `00`\\InvalidArgumentException11Receiver is no valid international mobile number; does contain non digit characters\\InvalidArgumentException20Sender is not valid; does contain non \[a-z,A-Z,0-9\] characters\\InvalidArgumentException21Sender is not a valid mobile number; it contains digits only but is longer than 16 bytes\\InvalidArgumentException22Sender is not a valid name; it contains alphanumeric characters but is longer than 11 bytes\\InvalidArgumentException30Message content is not valid; it is longer than 160 bytes but the message type is set to `ChromaX\GoyyaMobile\Message::MESSAGE_TYPE_TEXT_SMS`ChromaX\\CommonException\\NetworkException\\Base\\NetworkException40HTTP request failedChromaX\\CommonException\\ApiException\\InvalidResponseException41Response HTTP status code is not in the `2xx` rangeChromaX\\CommonException\\ApiException\\Base\\ApiException42The Goyya Mobile provider webservice responded with an errorChromaX\\CommonException\\ApiException\\UnexpectedResponseException43The Goyya Mobile provider webservice responded with an unexpected and therefore not parsable response bodyFull example
------------

[](#full-example)

```
require_once('path/to/vendor/autoload.php');

use ChromaX\CommonException;

try {
	$shortMessage = new ChromaX\GoyyaMobile\Message();
	$shortMessage
		->setAccountId('GOYYA_ACCOUNT_ID')
		->setAccountPassword('GOYYA_ACCOUNT_PASSWORD')
		->setDebugMode(true)
		->setReceiver('RECEIVER_MOBILE_NUMBER')
		->setSender('SENDER_NAME_OR_MOBILE_NUMBER')
		->setDelayedSubmission(true)
		->setSubmissionDate(strtotime('+6 hours'))
		->setSubmissionPlan(ChromaX\GoyyaMobile\Message::PLAN_QUALITY)
		->setMessageType(ChromaX\GoyyaMobile\Message::MESSAGE_TYPE_OVERLONG_SMS)
		->setMessage('Curabitur blandit tempus porttitor. ÄÖÜß~')
		->submit();
	echo 'Message ID ' . $shortMessage->getMessageId() . PHP_EOL;
	echo 'Message count ' . $shortMessage->getMessageCount() . PHP_EOL;
} catch (\InvalidArgumentException $exception) {
	echo $exception->getMessage() . PHP_EOL;
	echo $exception->getCode() . PHP_EOL;
} catch (CommonException\NetworkException\Base\NetworkException $exception) {
	echo $exception->getMessage() . PHP_EOL;
	echo $exception->getCode() . PHP_EOL;
} catch (CommonException\ApiException\Base\ApiException $exception) {
	echo $exception->getMessage() . PHP_EOL;
	echo $exception->getCode() . PHP_EOL;
}

```

Contribution
------------

[](#contribution)

Contributing to our projects is always very appreciated.
**But: please follow the contribution guidelines written down in the [CONTRIBUTING.md](https://github.com/chroma-x/php-goyyamobile/blob/master/CONTRIBUTING.md) document.**

TODOs
-----

[](#todos)

- Decorate the code base with some unit tests.
- Publish contribution guidelines.
- Add TokenAuth based authentication instead of using account ID and password as credentials.
- Extend the basic API by some other useful methods like removing pending messages and sending bulk messages.

License
-------

[](#license)

PHP Goyya Mobile simple API is under the MIT license.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity66

Established project with proven stability

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 ~125 days

Recently: every ~432 days

Total

15

Last Release

1941d ago

Major Versions

0.2 → 1.02016-04-06

1.3 → 2.02016-04-15

2.0.4 → 3.0.02016-07-11

3.0.0 → 4.0.02016-07-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5921241?v=4)[Martin Brecht-Precht](/maintainers/bonscho)[@Bonscho](https://github.com/Bonscho)

---

Tags

api-clientcomposer-packagegoyya-mobilephp-librarysms-apisms-gatewaysms-messageswebservicesmsGoyya

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[daixianceng/yii2-smser

Yii2 SMS extension

862.9k1](/packages/daixianceng-yii2-smser)[fotografde/cakephp-sms

SMS Plugin for CakePHP

1273.2k](/packages/fotografde-cakephp-sms)[ender/yunpian-sms

A php SDK for yunpian(云片网络短信服务商) sms RESTFULL API

294.9k](/packages/ender-yunpian-sms)

PHPackages © 2026

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