PHP Classes

USSD PHP PDU Converter: Convert Portable Data Unit commands

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 187 All time: 8,628 This week: 68Up
Version License PHP version Categories
ussd-pdu-converters 1.0.0Freely Distributable5Hardware
Description 

Author

This class can convert Portable Data Unit commands.

It takes a string with a command and converts it to PDU command.

The class can also take a PDU answer and convert it into readable text.

A Java version of the class is also made available.

Innovation Award
PHP Programming Innovation award nominee
February 2017
Number 11


Prize: SourceGuarding PHP encoder tool
USSD (Unstructured Supplementary Service Data) is a technology for sending text messages from a mobile phone on GSM network and applications that process those messages by the means of Portable Data Units (PDU).

This class can encode and decode commands in PDU format into text.

Manuel Lemos
Picture of Stefan Jibrail Froelich
  Performance   Level  
Name: Stefan Jibrail Froelich is available for providing paid consulting. Contact Stefan Jibrail Froelich .
Classes: 6 packages by
Country: United States United States
Age: ???
All time rank: 1105159 in United States United States
Week rank: 46 Up6 in United States United States Up
Innovation award
Innovation award
Nominee: 3x

Documentation

PduConverters

PDU (Portable Data Unit) Converters implemented currently in Java and PHP.

I needed to convert between PDU and simple text for a USSD project. All I could find online were SMS PDU converters and they didn't work for me. I found https://github.com/gnomeby/ussd and extracted the conversion code. The PHP version is a exactly what I took from the code. The Java version is a direct port.

Usage

For PHP

require 'Converter.php';

use Pdu\Converter;

var_dump(Converter::toPDU('*124#')); //-> string 'AA988C3602' (length=10)
var_dump(Converter::toText('54747A0E6A97E7F3F0B90CBA87E7A0F1DB6D2FCBE9657208')); //-> string 'This message was converted!' (length=27)

For Java

//copy the code into your project or however you do these things

Converter.toPDU("*124#");
Converter.toText("54747A0E6A97E7F3F0B90CBA87E7A0F1DB6D2FCBE9657208");

Copyright

Please use as you please. If you can, contribute improvements you make to the code. If you port it into another language, it would be great if you contributed that back as well. We have a suprising vacuum in this area online.


  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file Converter.java Data Auxiliary data
Plain text file Converter.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:187
This week:0
All time:8,628
This week:68Up