makemymails-sms/makemymails-sms

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

API client library for the MakeMyMails sms

1.0 2014-08-22 12:51 UTC

This package is not auto-updated.

Last update: 2024-04-23 02:44:42 UTC


README

Free web api service provided courtsey: http://www.makemymails.com To use this library you have to signup for a free web account on makemymails.com. Your makemymails account will generate an API key for you that you can use with this library to send sms that is automatically routed via your android phone.

Quickstart

Installing library

Installing via Composer:

You can use composer to install makemymails-sms. To install composer:

curl -s http://getcomposer.org/installer | php

Now, Create a composer.json at the base of the project's root directory to hold your dependencies:

{
    "require": {
        "makemymails-sms/makemymails-sms": "1.0.*"
    }
}

Then use the composer.phar script to install the dependency

php composer.phar install

Installing from zip release:

  • Download the latest release
  • Unpack the zip file.
  • Move the files somewhere in your project. Then you can use the API by using require_once call:
require_once 'location-of-source/makemymails-sms/mmm.php';

Installing android backend and obtaining API key

  • Sign up on Makemymails [1] and note your username somewhere
  • Install Makemymails Android App [2] Enter MMM username you used to register on the makemymails website. (Press "Associate username" button to associate your device with Makemymails web account)
  • Visit http://www.makemymails.com/sms/api-details/ [3] This page contains the MMM_API_KEY which can be used with this library. Please note it at a safe place and do not share it with anyone as the key is unique to you.

Steps with illustrations are available in this doc [4]

Sending sms from your php code

// import the library
require_once 'location-of-source/makemymails-sms/mmm.php'; 

$MMM_API_KEY = "ASFERSFLHFWSDNW";
$DEVICE_ID = "132";

// initialize the MMM object..
$mmm_client = new MMM($MMM_API_KEY, $DEVICE_ID);

//  NOTE: You can also set your api key and device id in 
// the environment variables. They will be automatically pulled from the environment.
// for api key,set environment variable:
//
// export MMM_API_KEY="your api key"
//
// for device id:
// export MMM_DEVICE_ID="1321"
// after setting the environment vars, you can simply call:

$mmm_client = new MMM();    

$message = "This is a message sent via makemymails-sms";
$send_to_no = "123456789"; // this should be a string

// To send request via curl(requires PHP cURL as a dependency)
$result = $mmm_client->send_msg_via_curl($message, $send_to_no);

// to send request without using cURL(requires php>=5.2.0)
$result = $mmm_client->send_msg($message, $send_to_no);

Requirements

  • Android Phone must be connected to internet at all times
  • Sim on the android phone for sending messages.

Warning

Warning: Api calls you make cause sms to be sent via your android phone, please make sure you install an sms pack/plan before sending sms.