athmarios/yaml-response

Laravel 8 的 YAML 解析器。

v1.0.2 2021-03-08 19:47 UTC

This package is auto-updated.

Last update: 2024-09-09 03:43:43 UTC


README

GitHub license

此包允许您的应用程序判断请求是否想要 YAML 响应,然后也可以以 YAML 格式响应。专为 Laravel 8 设计。

安装

您可以通过 composer 引入此包

$ composer require athmarios/yaml-response

用法

检查请求是否想要 YAML 响应,然后以 YAML 格式响应...

// app/Http/routes.php

use Illuminate\Http\Request;

Route::get('/some/route', function (Request $request) {
	// Was this a YAML request?
	if ($request->wantsYaml()) {
		// Then let's respond with YAML!
		response()->yaml(['This is my YAML response!']);
	}
});

许可证

MIT 许可证 (MIT)。请参阅许可证文件获取更多信息。