Created
May 24, 2019 14:54
-
-
Save seregazhuk/2087545a9cdebcb84d900ea41afed30b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use React\EventLoop\Factory; | |
use React\Filesystem\Filesystem; | |
use function React\Promise\Stream\unwrapWritable; | |
require __DIR__ . '/../../vendor/autoload.php'; | |
$loop = Factory::create(); | |
$filesystem = Filesystem::create($loop); | |
$fileStream = unwrapWritable($filesystem->file('test.txt')->open('cw')); | |
$loop->addPeriodicTimer(1, function () use ($fileStream) { | |
$fileStream->write("Hello world\n"); | |
}); | |
$loop->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment