1. Go to this page and download the library: Download aquachocomint/zxtouch-php 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/ */
aquachocomint / zxtouch-php example snippets
$zxtouch = new \zxtouch\ZXTouch("127.0.0.1"); //Connect to the device that is running ZXTouch
$coords = new \zxtouch\element\Coordinates(500, 750); //We will touch the screen at this point
//Touch a screen
$zxtouch->touch(new \zxtouch\element\touch\TouchDown(1, $coords));
usleep(800000); //Wait for 0.8 seconds
$zxtouch->touch(new \zxtouch\element\touch\TouchUp(1, $coords));
//But you can tap a screen without these codes. Just call `\zxtouch\ZXTouch::tap()` method. (
$zxtouch = new \zxtouch\ZXTouch("127.0.0.1"); //"127.0.0.1" is the ip address to connect the device
$point = new \zxtouch\element\Coordinates(20, 50); //We will tap this point
$zxtouch->tap($point);
$screen = $zxtouch->getScreenSize(); //This will return \zxtouch\result\ScreenSizeResult
var_dump($screen->getWidth(), $screen->getHeight()); //It will print width and height information
bash
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.