Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (8) | Download .zip | Reputation | Support forum | Blog (1) | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2023-09-18 (3 months ago) | Not yet rated by the users | Total: 41 | All time: 10,758 This week: 118 |
Version | License | PHP version | Categories | |||
swotch 1.0.0 | Shareware | 8 | System information, Files and Folders, P... |
Description | Author | ||||||||||||||
This package can watch file changes in PHP Swoole applications. Innovation Award |
|
Swoole file system changes watcher.
composer require ahmard/swotch
use Swotch\Watcher;
require 'vendor/autoload.php';
$paths = [
__DIR__ . '/app/',
__DIR__ . '/views/',
];
Watcher::watch($paths)->onAny(function (){
echo "File changes detected\n";
});
use Swoole\Http\Request;
use Swoole\Http\Response;
use Swoole\Http\Server;
use Swotch\Watcher;
require 'vendor/autoload.php';
$server = new Server('0.0.0.0', 9000);
$server->on('request', function (Request $request, Response $response) {
$response->end('Hello world');
});
$server->on('start', function (Server $server) {
echo "Server started at http://0.0.0.0:9000\n";
$paths = [
__DIR__ . '/app/',
__DIR__ . '/views/',
];
Watcher::watch($paths)->onAny(fn() => $server->reload());
});
$server->start();
Files |
File | Role | Description | ||
---|---|---|---|---|
src (2 files) | ||||
tests (1 file) | ||||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
phpstan.neon | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | src |
File | Role | Description |
---|---|---|
AbstractEvent.php | Class | Class source |
Watcher.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.