-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Implementation of Hyperf View in Nano #9
Comments
/assign @Reasno |
It is no different from standard hyperf. $app->config([ 'view' => [ 'engine' => BladeEngine::class]);
$app->get('/', function(RenderInterface $render){
return $render->render('index', ['name' => 'Hyperf']);
}); Remember to require hyperf/view first. |
Thank you but how about the static resources configuration? Where to put this exactly? |
I got also this |
Put all relevant configurations in $app->config(). They follow the same structure in standard hyperf, except that the top-level keys are mapped from file names. For example $app->config([
'view' => [
'engine' => BladeEngine::class
],
'task' => [
'settings' => [
'task_worker_num' => 8,
'task_enable_coroutine' => false,
],
'callbacks' => [
// Task callbacks
SwooleEvent::ON_TASK => [Hyperf\Framework\Bootstrap\TaskCallback::class, 'onTask'],
SwooleEvent::ON_FINISH => [Hyperf\Framework\Bootstrap\FinishCallback::class, 'onFinish'],
],
],
'server' => [
'settings' => [
'document_root' => BASE_PATH . '/public',
'enable_static_handler' => true,
],
]
]); |
I've tried to configuration below but got this $app->config([
'db.default' => [
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', 3306),
'database' => env('DB_DATABASE', 'nano'),
'username' => env('DB_USERNAME', 'username'),
'password' => env('DB_PASSWORD', 'password'),
],
'view' => [
'engine' => BladeEngine::class,
],
'task' => [
'settings' => [
'task_worker_num' => 8,
'task_enable_coroutine' => false,
],
'callbacks' => [
SwooleEvent::ON_TASK => [Hyperf\Framework\Bootstrap\TaskCallback::class, 'onTask'],
SwooleEvent::ON_FINISH => [Hyperf\Framework\Bootstrap\FinishCallback::class, 'onFinish'],
],
],
'server' => [
'settings' => [
'document_root' => __DIR__ . '/public',
'enable_static_handler' => true,
],
]
]); |
'engine' => BladeEngine::class, |
hyperf/task is required unless you use 'mode' => Mode::SYNC, |
Sorry but |
I see no reason why it is not working. Here is a working/tested demo: https://github.com/Reasno/nano-demo |
composer remove hyperf/task |
|
Hi, how can I implement the Hyperf
view
to render page in Nano? Since the structure of configuration of Hyperf and Nano is different.Thanks in advance.
The text was updated successfully, but these errors were encountered: