Skip to content

This Composer package simplifies route management in your PHP applications by allowing the use of PHP attributes to define routes in an elegant and expressive way. It streamlines the setup of custom routes, enabling developers to define routing rules that are clear and intuitive.

License

Notifications You must be signed in to change notification settings

ugo-brocard/router

Repository files navigation

Router

This Composer package simplifies route management in your PHP applications by allowing the use of PHP attributes to define routes in an elegant and expressive way. It streamlines the setup of custom routes, enabling developers to define routing rules that are clear and intuitive.

✨ Features

  • Define routes using PHP attributes: enhancing code readability and maintainability.
  • Flexible handling of route parameters and URL constraints.
  • Seamless integration with popular PHP frameworks.
  • Route group management for hierarchical organization of routes.
  • Middleware support for advanced request processing customization.
  • Comprehensive documentation and usage examples for quick adoption.

🔗 Installation

You can install this package via Composer:

composer require ugo-brocard/router

🧱 Usage

Here's a basic example of how to use this package to define a route using PHP attributes:

use Router\Attributes\{Route, Get, Post}

/**
 * Class MyController
 * 
 * @package Application\Controllers
*/
#[Route("/route-group")]
final class MyController
{
    #[Get("/route")]
    public function myAction(): string
    {
        // (...)
    }

    #[Post("/route")]
    public function yetAnotherAction(): int
    {
        // (...)
    }
}

For detailed documentation and usage examples, please refer to our documentation.

🛡 License

This project is licensed under the MIT License.

🤠 Credits

This package was developed and maintained by Ugo Brocard.

💖 Acknowledgments

I'd like to express my gratitude to the open-source community for their contributions and inspirations

About

This Composer package simplifies route management in your PHP applications by allowing the use of PHP attributes to define routes in an elegant and expressive way. It streamlines the setup of custom routes, enabling developers to define routing rules that are clear and intuitive.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages