Skip to content

Instantly share code, notes, and snippets.

Created September 14, 2014 13:27
Show Gist options
  • Save anonymous/f215a229e46a1674c78d to your computer and use it in GitHub Desktop.
Save anonymous/f215a229e46a1674c78d 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;
$file->size()->then(function($size) use ($file) {
var_export($size);
echo PHP_EOL;
$file->time()->then(function($time) {
var_export($time);
echo PHP_EOL;g
});
});
});
$rm = $filesystem->file('./test_rm');
$rm->exists()->then(function() use ($rm) {
$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