1. Go to this page and download the library: Download miqoo1996/routing 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/ */
miqoo1996 / routing example snippets
Example Web Route
use miqoo1996\routing\Core\Route;
use miqoo1996\routing\Http\Controllers\ExampleController;
Route::get('/', [ExampleController::class, 'welcomePage']);
Route::post('/post', [ExampleController::class, 'post']);
Route::put('/put', [ExampleController::class, 'put']);
Route::patch('/patch', [ExampleController::class, 'patch']);
Route::delete('/delete', [ExampleController::class, 'delete']);
Example API Route
use miqoo1996\routing\Core\Route;
use miqoo1996\routing\Http\Controllers\BooksController;
Route::initializeRESTApi();
Route::get('/book', [BooksController::class, 'retrieve']);
Route::post('/book', [BooksController::class, 'store']);
Route::put('/book', [BooksController::class, 'update']);
Route::patch('/book', [BooksController::class, 'update']);
Route::delete('/book', [BooksController::class, 'delete']);
Controller Example
namespace miqoo1996\routing\Http\Controllers;
class BooksController
{
private TestService $testService;
public function __construct(TestService $testService)
{
$this->testService = $testService;
}
public function retrieve(YourTestCalss $yourTestCalss)
{
var_dump($yourTestCalss, $this->testService);
}
public function store()
{
}
public function update()
{
}
public function delete()
{
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.