承接 azandazama/menuplus 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

azandazama/menuplus

Composer 安装命令:

composer require azandazama/menuplus

包简介

MenuPlus: A PHP library that simplifies the process of creating ussd applications

README 文档

README

Ussd is an amazing technology for anyone looking to create apps which can reach a large volume of people. Ussd is an ancient technology yet it still serves a purpose in our day and age. This PHP library simplies the process behind creating said apps with the AAT Mobile Ussd API

Read more about MenuPlus:

Requirements

In order for you to use MenuPlus you need to set up an account with AAT Mobile for ussd, after which you can require this library and code away 👨🏽‍💻

Installation

MenuPlus is installed via Composer.

composer require azandazama/menuplus

You can of course also manually edit your composer.json file

{
    "require": {
        "azandazama/menuplus": "^1.0"
    }
}

Ussd Menus

MenuPlus offers different types of ussd menus which serve different purposes. Code and screenshots will be shown below.

Standard Menu

This menu has all the bells and whistles offering you with unlimited options and option urls. screenshot

$ussd->title = 'Welcome to the Example Ussd Platform!';
$ussd->options = ['Option 1', 'Option 2', 'Option 3'];
$ussd->option_url = ['index.php?page=1', 'index.php?page=2', 'index.php?page=3'];
echo $ussd->addMenu($url);

Options have URLs( $ussd->option_url ) and you can consider Options( $ussd->options ) as links and menus as pages. Options and Option URLs are parallel arrays and each option corrisponds to each option URL

Free Text Menu

This menu has no options and the title is therefore considered as the option. screenshot

$ussd->title = 'Please provide first and last name';
$ussd->option_url = 'index.php?file=4';
echo $ussd->addMenu($url);

Paginated Menu

This menu offers all the bells and whistles and also allows you to order your menu with pagination

$ussd->title = 'Select an option';
$ussd->options = ['Option 1', 'Option 2', 'Option 3', 'Option 4', 'Option 5', 'Option 6', 'Option 7'];
// Menu options can all share the same url
$ussd->option_url = 'index.php?page=5';
// [3] is the amount of options that will be shown in this menu
return $ussd->paginateMenu($url, 3);

Getting Started

The following is a basic usage example of the MenuPlus library.

<?php
require_once './vendor/autoload.php';

$ussd = new \MenuPlus\Ussd;
// ensure your url ends with a backslash
$url = 'http://localhost:7000/';

function initMenu($ussd, $url)
{
    switch(@$_GET['page'])
    {
        case '':
            // This is the first menu the application will serve
            $ussd->title = 'Welcome to the Example Ussd Platform!';
            $ussd->options = ['Questionnaire', 'Register', 'Shows available', 'Exit'];
            $ussd->option_url = ['index.php?page=1', 'index.php?page=2', 'index.php?page=3', 'index.php?page=4', 'index.php?page=exit'];
            return $ussd->addMenu($url);
        break;
        case 1: 
            $ussd->title = 'What year was Nelson Mandela born';
            $ussd->options = ['1900', '1918', 'Back'];
            $ussd->option_url = ['index.php?page=answer&ans=wrong', 'index.php?page=answer&ans=correct', 'index.php'];
            return $ussd->addMenu($url);
        break;
        case 2:
            // FreeText Menu's have no options just one title and url
            $ussd->title = 'Please provide first and last name';
            $ussd->option_url = 'index.php?file=names';
            return $ussd->addMenu($url);
        break;
        case 3:
            $ussd->title = 'Select your favourite TV show';
            $ussd->options = ['The Simpsons', 'Star Wars', 'Peanuts', 'South Park',
            'Courage the Cowardly Dog', 'Avatar: The Last Airbender',
            'Dexters Laboratory', 'Futurama', 'The Jetsons', 'Phineas and Ferb',
            'Kim Possible', 'Samurai Jack', 'Dora the Explorer'];
            // Menu options can all share the same url
            $ussd->option_url = 'index.php?page=shows';
            // [5] is the amount of options that will be shown per menu
            return $ussd->paginateMenu($url, 5);
        break;
        case 'exit': 
            $ussd->title = "Thank you!\nUssd Platform";
            return $ussd->addMenu($url);
        break;
    }
}

echo initMenu($ussd, $url);

Author

License

MIT

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固