There is no license information available for the latest version (v1.0) of this package.

Providing wrappers for danish sms gateways

v1.0 2012-03-12 20:35 UTC

This package is not auto-updated.

Last update: 2023-09-16 08:11:10 UTC


Smesg is a library to help you send sms messages via different providers.

Currently supported providers:

So far the library only supports sending sms messages, querying for status, canceling and other services will be added.


Install via composer:

    "require": {
        "mrbase/smesg": "*"

or clone this repository:

git clone Smesg


First off, you need a contract with one of the provides for you to be able to send anything.

You really sould use a psr-0 compliant autoloader, it will make your day.

A simple one can be found in tests/autoloader.php.

Then you need to set the configure variables for the provider (explained in details below) and provide the transport adapter.

Currently only one transport adapter exists, but you can add your own by implementing the Smesg\Adapter\AdapterInterface.

Unwire example:


require __DIR__ . '/tests/autoloader.php';

$config = array(
    'user' => 'test',
    'password' => 'test....',
    'appnr' => '1212',
    'mediacode' => 'test',
    'price' => '0.00DK',

$transport = new Smesg\Adapter\PhpStreamAdapter();
$provider = new Smesg\Provider\UnwireProvider($transport, $config);

$provider->addMessage('mobile_number', 'message');
$response = $provider->send();

Note, the mobile_number must be a valid MSISDN compliant number or the service will fail!

In-depth docs for the providers


The provider for inmobile implements the following services:

  • smspush
  • smspushxml
  • smsclookup (you need a seperate agreement to have access to this service)

smspush: is used to send single messages.

smspushxml: is used when sending batch messages, note that you can only send 1024 messages in one batch, the provider does not handle the split into seperate batches.

smsclookup: is used to loockup serviceproviders for mobile numbers. implementing a cache for this is on the todo list.

Default configuration values:


$config = array(
    'user' => '',
    'password' => '',
    'appnr' => '',
    'mediacode' => '',
    'price' => '',
    'get_smsc' => false,

Please note that the price format uses period (.) as decimal devider.

Example: 0.00DKK is the correct value if you do not tax the messages in Denmark.

Possible default values when sending batch messages:

$defaults = array(
    'operator' => null,
    'shortcode' => null,
    'mediacode' => null,
    'price' => array(
        'amount' => null,
        'currency' => null,
        'vat' => null,
    'content' => null,

If left alone the price array will be calculated from the value set in the configuration.

If you want to send the same message to a group of people you have the posibility to setup defaults for the messages.

Here is a simple example extending the demo above.

// ....
$provider = new Smesg\Provider\UnwireProvider($transport, $config);

    'shortcode' => '1212',
    'mediacode' => 'test',
    'content' => 'this is the message send',

$provider->addMessage('mobile_number_1', null);
$provider->addMessage('mobile_number_2', null);
$provider->addMessage('mobile_number_3', null);
$response = $provider->send();

Build Status