PHP code example of danilowa / laravel-api-response-builder
1. Go to this page and download the library: Download danilowa/laravel-api-response-builder 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/ */
danilowa / laravel-api-response-builder example snippets
/*
|--------------------------------------------------------------------------
| Custom Response Structure
|--------------------------------------------------------------------------
| Define a custom structure for responses. The example below
/*
|--------------------------------------------------------------------------
| Response Data Wrapper
|--------------------------------------------------------------------------
| If enabled, the response data will be wrapped in an additional 'data'
| key. This is useful if you want a consistent structure for all responses.
|
*/
'wrap_data' => true,
/*
|--------------------------------------------------------------------------
| Response Data Wrapper Key
|--------------------------------------------------------------------------
| This value sets the key used to wrap the response data. By default, it is
| 'data', but you can customize it according to your API structure.
|
*/
'wrap_data_key' => 'items',