dugajean/laravel-yaml

YAML parser for Laravel.

1.0.1 2016-07-04 12:47 UTC

This package is auto-updated.

Last update: 2023-05-20 15:07:09 UTC


README

GitHub issues GitHub license Packagist

This package will allow your application to determine whether the request wants a YAML response and then also respond with YAML.

Install

You can pull in the package via composer:

$ composer require dugajean/laravel-yaml

For Laravel 5.4 and lower, add the following service provider to your config/app.php:

// config/app.php

'providers' => [
    ...
    Dugajean\Yaml\YamlServiceProvider::class,
];

For Laravel 5.5 and greater, the package will auto register the provider for you.

Usage

See if the request wants a YAML response and then respond with 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!']);
	}
});

License

The MIT License (MIT). Please see License File for more information.

Support on Beerpay

Hey dude! Help me out for a couple of 🍻!

Beerpay Beerpay