use RouteSet\RouteSet; $routeSet = new RouteSet('/blog'); $routeSet->get('', function() { // Shows all blog posts }); $routeSet->get('/:id', function($id) { // Shows the blog post with the given ID }); $routeSet->run(); // URL example: example.com/blog/ // URL example: example.com/blog/1
use RouteSet\RouteSet; $routeSet = new RouteSet(); $routeSet->post('/form', function() { // Handles form submission }); $routeSet->run(); // URL example: example.com/form (POST request)This example creates a simple route set for handling form submissions. It sets up a route for the `/form` path with a `POST` request method. When the form is submitted, the callback function will be called to handle the request. Package library: The PHP Route set is a standalone library that can be installed using Composer. It does not have any external dependencies.