PHP code example of athmarios / yaml-response

1. Go to this page and download the library: Download athmarios/yaml-response library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

athmarios / yaml-response example snippets


// 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!']);
	}
});