1. Go to this page and download the library: Download kingbes/phprobot 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/ */
kingbes / phprobot example snippets
use KingBes\PhpRobot\Mouse;
$Mouse = new Mouse();
/**
* 鼠标指针位置 function
*
* @return array
*/
public function mouse_pos(): array
{}
/**
* 鼠标单击 function
*
* @param string $button left right middle
* @return self
*/
public function mouse_click(string $button): self
{}
/**
* 鼠标双击 function
*
* @param string $button left right middle
* @return self
*/
public function mouse_double_click(string $button): self
{}
/**
* 将鼠标(左)拖动到指定位置。 function
*
* @param integer $x
* @param integer $y
* @return self
*/
public function mouse_left_drag(int $x, int $y): self
{}
/**
* 相对于当前位置拖动鼠标(左)。 function
*
* @param integer $offset_x
* @param integer $offset_y
* @return self
*/
public function mouse_drag_rel(int $offset_x, int $offset_y): self
{}
/**
* 移动鼠标到 x y function
*
* @param integer $x
* @param integer $y
* @return self
*/
public function mouse_move_mouse(int $x, int $y): self
{}
/**
* 相对于当前位置移动鼠标。 function
*
* @param integer $offset_x
* @param integer $offset_y
* @return self
*/
public function move_mouse_rel(int $offset_x, int $offset_y): self
{}
/**
* 鼠标平滑移动指定位置 function
*
* @param integer $x
* @param integer $y
* @param integer $duration_ms 毫秒
* @param string $tween 预览补间 参数请看下面 `预览补间` 说明
* @return self
*/
public function move_mouse_smooth(int $x, int $y, int $duration_ms, string $tween): self
{}
/**
* 当前平滑移动鼠标 function
*
* @param integer $offset_x
* @param integer $offset_y
* @param integer $duration_ms 毫秒
* @param string $tween 预览补间 参数请看下面 `预览补间` 说明
* @return self
*/
public function move_mouse_smooth_rel(int $offset_x, int $offset_y, int $duration_ms, string $tween): self
{}
/**
* 鼠标按下 function
*
* @param string $button left right middle
* @return self
*/
public function mouse_down(string $button): self
{}
/**
* 鼠标弹起 function
*
* @param string $button left right middle
* @return self
*/
public function mouse_up(string $button): self
{}
use KingBes\PhpRobot\Screen;
$Screen = new Screen();
/**
* 获取屏幕指定位置的颜色rgb function
*
* @param integer $x
* @param integer $y
* @return array
*/
public function pixel_color(int $x, int $y): array
{}
/**
* 获取屏幕大小 function
*
* @return array
*/
public function screen_size(): array
{}
use KingBes\PhpRobot\Keyboard;
$Keyboard = new Keyboard;
/**
* 是否点击键盘某键 function
*
* @param integer $key 整数键码值
* @return boolean
*/
public function isKeyPressed(int $key): bool
{}
/**
* 点击键盘某键 function
*
* @param integer $key 整数键码值
* @return void
*/
public function onClickKey(int $key): void
{}
/**
* 按下键盘某键 function
*
* @param integer $key
* @return self
*/
public function pressKey(int $key): self
{}
/**
* 弹起键盘某键 function
*
* @param integer $key
* @return self
*/
public function releaseKey(int $key): self
{}
// 引入
use KingBes\PhpRobot\Mouse;
// 实例
$Mouse = new Mouse();
// 获取鼠标当前指针位置
$pos = $Mouse->mouse_pos();
var_dump($pos);