Download the PHP package marcosdipaolo/router without Composer

On this page you can find all versions of the php package marcosdipaolo/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package router

MDP Router

A modern, production-ready PHP router library built with PHP 8.2+ and attribute-based routing. It provides a clean, expressive API for defining routes, handling middleware, and managing HTTP requests and responses.

Features

Installation

Quick Start

1. Setup Your Entry Point

Create an index.php file at your project root:

2. Configure Your .htaccess

3. Define Routes in Controllers

Core Concepts

Request/Response Objects

The router provides clean abstractions for HTTP requests and responses:

Route Parameters

Define dynamic routes with parameters:

Route Groups

Group related routes with common prefixes and middleware:

Middleware

Create custom middleware by implementing MiddlewareInterface:

Add middleware globally or per-route:

Built-in Middleware

CORS Middleware

Handle cross-origin requests:

Security Headers Middleware

Add security headers automatically:

Method Spoofing Middleware

Allow forms to use PUT/PATCH/DELETE via _method parameter:

In your HTML form:

Route Caching

Routes are automatically cached when enabled. This compiles all route definitions into a PHP file for maximum performance:

Reverse Routing

Generate URLs from route names:

Debugging

Enable debug mode to get detailed error information:

HTTP Status Codes

Commonly used status codes:

Security Best Practices

  1. Always validate input: Validate and sanitize all user input
  2. Use HTTPS: Ensure all traffic is encrypted
  3. Add CORS headers: Only allow trusted origins
  4. Implement authentication: Protect sensitive routes with middleware
  5. Use prepared statements: When working with databases
  6. Keep cache directory secret: Don't expose the cache directory publicly
  7. Enable security headers: Always include security headers

Error Handling

The router provides built-in error handling with debug mode for development:

Create custom error handling middleware:

Testing

The router includes comprehensive tests:

Write your own tests:

Performance Tips

  1. Enable route caching (production)
  2. Use parameter constraints in routes
  3. Load only needed controllers in Router::create()
  4. Cache middleware results when possible
  5. Use lazy loading for dependencies in container

Contributing

Contributions are welcome! Please read CONTRIBUTING.md first.

License

MIT License - see LICENSE file


All versions of router with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
marcosdipaolo/container Version ^1.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package marcosdipaolo/router contains the following files

Loading the files please wait ...