PHP code example of danharper / laravel-jsonx

1. Go to this page and download the library: Download danharper/laravel-jsonx 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/ */

    

danharper / laravel-jsonx example snippets


protected $routeMiddleware => [
  // ...
  'jsonx' => \danharper\LaravelJSONx\JSONxMiddleware::class,
];

Route::get('foo', ['middleware' => ['jsonx'], 'uses' => function() {
  return [
    'fruits' => ['apple', 'banana', 'pear'],
    'something' => true,
  ];
});

Route::post('/', ['middleware' => ['jsonx'], 'uses' => function() {
  return [
    'hello' => request('address.city')
  ];
});