1. Go to this page and download the library: Download hyperf/nano library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Hyperf\HttpMessage\Stream\SwooleStream;
use Hyperf\Nano\Factory\AppFactory;
;
});
$app->addExceptionHandler(function ($throwable, $response) {
return $response->withStatus('418')
->withBody(new SwooleStream('I\'m a teapot'));
});
$app->run();
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Nano\Factory\AppFactory;
{
$this->output->info("Hello, {$name}");
})->setDescription('The echo command.');
$app->run();
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Framework\Event\BootApplication;
use Hyperf\Nano\Factory\AppFactory;
class)->info('App started');
});
$app->run();
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Nano\Factory\AppFactory;
sleep(1);
$this->container->get(StdoutLoggerInterface::class)->info('Processing...');
}
})->setName('nano-process')->setNums(1);
$app->addProcess(function(){
$this->container->get(StdoutLoggerInterface::class)->info('Determine whether the process needs to be started based on env...');
})->setName('nano-process')->setNums(1)->setEnable(\Hyperf\Support\env('PROCESS_ENABLE', true))));
$app->run();
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Nano\Factory\AppFactory;
>get(StdoutLoggerInterface::class)->info('execute every second!');
})->setName('nano-crontab')->setOnOneServer(true)->setMemo('Test crontab.');
$app->run();