Download the PHP package websitesql/router without Composer
On this page you can find all versions of the php package websitesql/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download websitesql/router
More information about websitesql/router
Files in websitesql/router
Package router
Short Description Router component for WebsiteSQL framework
License MIT
Informations about the package router
WebsiteSQL Router
A lightweight, flexible routing library for PHP applications that extends the functionality of League\Route and League\Container while adding a custom API strategy for consistent API responses.
Overview
WebsiteSQL Router is built on top of the following packages:
- League\Route - Fast routing and dispatcher
- League\Container - Dependency injection container
This library extends these components and provides a custom ApiStrategy to standardize API responses across your application.
Installation
Install via Composer:
Basic Usage
Features
Extended Router
The Router class extends League\Route's Router with additional functionality:
- Simplified API route definitions
- Automatic content negotiation
- Configurable middleware application
- Enhanced error handling
Extended Container
The Container class extends League\Container to provide:
- Automatic controller resolution
- Simplified service registration
- Integration with router components
Custom ApiStrategy
The ApiStrategy standardizes how API responses are formatted:
Benefits of the ApiStrategy:
- Consistent JSON response structure
- Automatic status code handling
- Standard error formatting
- Content negotiation
- CORS support
Configuration
Customizing ApiStrategy
Error Handling
The ApiStrategy automatically converts exceptions to appropriate HTTP responses:
NotFoundException→ 404 Not Found responseUnauthorizedException→ 401 Unauthorized responseForbiddenException→ 403 Forbidden response- Other exceptions → 500 Internal Server Error response
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This package is open-sourced software licensed under the MIT license.
All versions of router with dependencies
league/route Version ^5.0
laminas/laminas-diactoros Version ^2.8
laminas/laminas-httphandlerrunner Version ^2.1
league/container Version ^5.0