Skip to content

Instantly share code, notes, and snippets.

@jsor
Forked from anonymous/test.php
Last active August 29, 2015 14:06
Show Gist options
  • Save jsor/6c275cb90ed181f03f3f to your computer and use it in GitHub Desktop.
Save jsor/6c275cb90ed181f03f3f to your computer and use it in GitHub Desktop.
<?php
require 'vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$filesystem = new \React\Filesystem\Filesystem($loop);
$loop->addTimer(0.0001, function() use ($filesystem) {
$file = $filesystem->file(__FILE__);
$file->exists()->then(function() use ($file) {
echo __FILE__ . ' exists', PHP_EOL;
return $file->size();
})->then(function($size) use ($file) {
var_export($size);
echo PHP_EOL;
return $file->time();
})->then(function($time) {
var_export($time);
echo PHP_EOL;g
});
$rm = $filesystem->file('./test_rm');
$rm->exists()->then(function() use ($rm) {
return $rm->remove();
})->then(function() {
echo 'test_rm removed', PHP_EOL;
}, function() {
echo 'test_rm note removed', PHP_EOL;
});
});
$loop->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment