PHP code example of gromit / oc-routesbrowser-plugin
1. Go to this page and download the library: Download gromit/oc-routesbrowser-plugin 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/ */
gromit / oc-routesbrowser-plugin example snippets
// Here we got route with: uri "hello/{name}", method "GET", action "Closure"
// and one route parameter with name "name" type "string"
Route::get('hello/{name}', function (string $name) {
//
});
// Docblock for closure adds this info to route:
// description "Returns greeting" and route parameter description "Person name"
Route::get('hello/{name}',
/**
* Returns greeting
*
* @param string $name Person name
*/
function (string $name) {
//
}
);
// OR
// Here route action will be "\Controllers\Namespace\GreetController@greet"
Route::get('/hello/{name}', [GreetController::class, 'greet']);
class GreetController extends \Illuminate\Routing\Controller
{
/**
* Returns greeting
*
* @param string $name Person name
*/
public function greet(string $name) {
//
}
}
Route::get('/hello/{name}', [GreetController::class, 'greet']);
class GreetController extends \Illuminate\Routing\Controller
{
/**
* Returns greeting
*
* @param string $name Person name
*/
public function greet(GreetRequest $request, string $name) {
//
}
}
// These will add request class "\Requests\Namespace\GreetRequest" and request parameters:
// "greeting" with type "string|null" and description "Greeting. Default - "Hello""
// and "friend" with type "string|null" and description "Friend name".
/**
* @property-read string|null $greeting Greeting. Default - "Hello"
* @property-read string|null $friend Friend name
*/
class GreetRequest extends \Illuminate\Foundation\Http\FormRequest
{
//
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.