stru/stru-hyperf-ui

Hyperf 的 Auth blade ui组件,配合 stru/stru-hyperf-auth 一起使用

v0.1.0 2022-01-25 08:14 UTC

This package is auto-updated.

Last update: 2022-06-25 09:15:23 UTC


README

Description

使用blade模板实现发布注册,登录视图

Installation

composer require stru/stru-hyperf-ui

Publish

php bin/hyperf.php vendor:publish hyperf/view
php bin/hyperf.php vendor:publish stru/stru-hyperf-ui

Config

// config/autoload/view.php
return [
    'engine' => BladeEngine::class,
    'mode' => Mode::TASK,
    'config' => [
        'view_path' => BASE_PATH . '/resources/views/',
        'cache_path' => BASE_PATH . '/runtime/view/',
    ],
];
// ocnfig/autoload/server.php
return [
    'settings' => [
        ...
        // 静态资源
        'document_root' => BASE_PATH . '/public',
        'enable_static_handler' => true,
        // Task
        'task_worker_num' => 2,
        'task_enable_coroutine' => false
    ],
    'callbacks' => [
        ...
        // Task callbacks
        Event::ON_TASK => [Hyperf\Framework\Bootstrap\TaskCallback::class, 'onTask'],
        Event::ON_FINISH => [Hyperf\Framework\Bootstrap\FinishCallback::class, 'onFinish'],
    ]
];

Use

public function showLogin()
{
    return view('auth.login');
}
public function showRegister()
{
    return view('auth.register');
}

Tips

// 为了使模板内的路由更加灵活,可以配置 config/autolaod/blade.php 文件,自己定义路由