1. Go to this page and download the library: Download mrcnpdlk/grandstream-xmlapp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Components\ElemBitmap;
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Components\ElemRectangle;
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Components\ElemSelect;
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Components\ElemString;
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Container;
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Event;
use mrcnpdlk\Grandstream\XMLApp\Application\Model\SoftKey;
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Styles;
use mrcnpdlk\Grandstream\XMLApp\Application\ModelConstant;
use mrcnpdlk\Grandstream\XMLApp\Application\View;
use mrcnpdlk\Grandstream\XMLApp\Helper\Color;
use mrcnpdlk\Grandstream\XMLApp\Helper\Rectangle;
etColor(new Color(0))
->setColorBorder(new Color(30))
)
->addItem('one', 1)
->addItem('two', 2)
->addItem('three', 3)
;
$oSelect_2 = new ElemSelect('select_2');
$oSelect_2->setStyles(new Styles(100))
->addItem('apple', 1)
->addItem('orange', 2)
->addItem('lemon', 3)
->move(0, 20)
;
$oContainer_2
->addElement($oSelect_1)
->addElement($oSelect_2)
->move(0, 20)
;
$oView->addContainer($oContainer_2);
/**
* Elements can be added directly on the View without using Container
*/
$oView->addElem(new ElemRectangle(10, 10));
/**
* You can also define SoftKey
*/
$oView->addSoftkey(new SoftKey(ModelConstant::ACTION_QUIT_APP, 'Exit'));
/**
* And define Events
*/
$oEvent = new Event(ModelConstant::STATE_OFFHOOK, ModelConstant::ACTION_DIAL, '299');
$oView->addEvent($oEvent);
/**
* Add picture (100x100) to screen
*/
$oBitmap = new ElemBitmap(
__DIR__ . '/../devel/logo.png',
new Rectangle(100)
);
$oView->addElem($oBitmap->move(120, 0));
/**
* Last thing. Left status bar can be disabled (more space on screen)
*/
$oView->setVisibleStatusLine(false);
/**
* Echo text for phone
*/
header('Content-type: application/xml; charset="utf-8"');
echo $oView->asTxt();