PHP code example of silvertipsoftware / rest-router
1. Go to this page and download the library: Download silvertipsoftware/rest-router 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/ */
Route::resource('logs', 'LogsController')->only(['store', 'destroy']);
// the 'logs.index' route doesn't need to be defined:
$path = URL::path(Log::class);
// $path = /logs
// the 'logs.show' route doesn't need to be defined:
$path = URL::path($logEntry);
// $path = /logs/123
$options = [
'shallow' => false, // defaults to true
'action' => 'edit', // RESTful actions 'create', 'edit' etc. or any other action you've defined
'format' => 'json' // added as an extension to the uri, can be anything
]