$router->get('/', function () { echo 'Hello, World!'; });
$router->get('/user/{id}', function ($id) { echo "User ID: " . $id; });
$router->post('/user', function () { // create new user }); $router->put('/user/{id}', function ($id) { // update user with given ID });This example defines two routes, one for creating a new user with a POST request, and the other for updating an existing user with a PUT request. In summary, PHP Router is a package library that provides a way to handle HTTP requests in PHP applications. It allows for defining routes with route parameters and HTTP method restrictions.