hollisho/lumen-request

http Request For Lumen

v1.0.1 2024-10-15 03:57 UTC

This package is auto-updated.

Last update: 2024-11-15 04:11:01 UTC


README

composer require hollisho/lumen-request

basic use

//定义Request对象
class RequestBo extend LumenRequest
{
    public $html_content;

    public $language_edit = 0;

    public function rules()
    {
        return [
            'html_content' => ['required'],
        ];
    }

    protected function messages()
    {
        return [
            'html_content.required' => 'html_content is required',
        ];
    }
}

//在控制器中注入Reqeust
class IndexController extends Controller
{

    /**
     * @param FetchHtmlRequest $request
     * @param DomRenderService $renderService
     * @return \Illuminate\Http\JsonResponse
     */
    public function parserHtml(RequestBo $request)
    {
        ......
    }
}