Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 44 | All time: 10,814 This week: 488 |
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 (8) |
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 (8) | / | src |
File | Role | Description |
---|---|---|
AbstractEvent.php | Class | Class source |
Watcher.php | 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. |
Install with Composer |
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.