dev-master
9999999-devA PHP library for creating automation robots
MIT
The Requires
by Nawarian NĂckolas
php bot windows automation linux desktop x11 xlib
Wallogit.com
2017 © Pedro PelĂĄez
A PHP library for creating automation robots
This project was made for fun, feel free to improve it :), (*1)
Under your project's folder type:
$ composer require nawarian/php-bot dev-master, (*2)
<?php require_once 'vendor/autoload.php';
Then you are ready to go :D, (*3)
PHPBot works directly with X11, using xdotool to
send commands. Further versions could add support to
other devices as well., (*4)
Make it independent from xdotool would also be nice,
projects like https://github.com/moriyoshi/php-Xlib are
a great shot! But still excludes MS Windows implementations..., (*5)
PHPBot now can work with Windows NT platforms too.
Is important to notice that: it uses compiled python files that
access the User32.dll API. Because of that, some antivirus software
might mark the files under ext/pyautogui/bin/dest folder as threads., (*6)
Also: the command pipeline funcionality has shown some bugs., (*7)
All commands alone returns a React\Promise\Promise, (*8)
You must have a React\EventLoop\LoopInterface object:, (*9)
$loop = React\EventLoop\Factory::create(); // Our code goes here! $loop->run();
As a command you can think of a interaction command, like a
button pressing, mouse moving ou clicking..., (*10)
Notice that all commands will only run if:
- The start() method is called
- Is in a command pipeline, (*11)
Is important to also notice that command pipelines will start by the moment you create it., (*12)
$dm = PHPBot\DesktopManager\Factory::create($loop);
$dm->keyboard()->type('Soooo cool!')->start()->then(function() {
// Remember, every command returns a Promise!
echo 'Just wrote it, dude! ;)';
});
$dm = PHPBot\DesktopManager\Factory::create($loop);
$dm->pointer()->moveTo(0, 0)->start()->then(function() {
// Remember, every command returns a Promise!
echo 'Guess where your mouse pointer is!';
});
$dm = PHPBot\DesktopManager\Factory::create($loop);
$dm->createCommandPipeline(
$dm->keyboard()->type('Soooo cool!'), // 1
$dm->keyboard()->sendKey(Keys::ENTER()), // 2
$dm->pointer()->moveTo(200, 200), // 3
$dm->pointer()->click(MouseButtons::LEFT()) // 4
)
->start()
->then(function() {
// This also returns a Promise, resolved when it all finishes
echo 'DONE!';
});
1, 2, 3 and 4 will execute at this exaclty order!, (*13)
examples/ folder out.Thank you :), (*14)
A PHP library for creating automation robots
MIT
php bot windows automation linux desktop x11 xlib