| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not enough user ratings | Total: 45 | All time: 10,816 This week: 54 | ||||
| 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();
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Data | Auxiliary data | |||
| Doc. | Documentation | |||
| / | src |
| File | Role | Description |
|---|---|---|
| |
Class | Class source |
| |
Class | Class source |
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| 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.