Download the PHP package mitsuki/attributes without Composer
On this page you can find all versions of the php package mitsuki/attributes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mitsuki/attributes
More information about mitsuki/attributes
Files in mitsuki/attributes
Package attributes
Short Description A lightweight and high-performance PHP router for the Mitsuki framework, leveraging Symfony Routing components for robust URL management.
License MIT
Informations about the package attributes
Mitsuki Attributes
Lightweight PHP 8 Metadata library for the Mitsuki Framework.
This package provides a set of native PHP 8 Attributes to define routing and controller configurations. By separating attributes into this standalone library, your application stays decoupled, and your domain logic remains clean.
✨ Features
- Zero Dependencies: Extremely light footprint with no external requirements.
- PHP 8+ Native: Leveraging the power of native attributes (no more DocBlock annotations).
- Highly Decoupled: Can be used in any project that needs a standardized way to mark controllers and routes.
- Strictly Typed: Fully compatible with static analysis tools like PHPStan or Psalm.
🚀 Installation
You can install the package via Composer:
🛠 Usage
This library provides two main attributes to decorate your classes and methods.
1. The Controller Attribute
Used at the class level to define a base prefix for all routes within that controller.
2. The Route Attribute
Used at the method level to define the specific path, name, and allowed HTTP methods.
🏗 Architecture
The Attributes act as a bridge between your code and the Mitsuki Router.
- Definition: You decorate your code with
#[Route]. - Reflection: The Mitsuki Router/Controller-Resolver reads these attributes using PHP's
ReflectionClass. - Execution: The framework configures the routing table based on this metadata.
📝 API Reference
Mitsuki\Attributes\Controller
| Parameter | Type | Description |
|---|---|---|
$baseUri |
string |
The prefix for all routes in the class. |
Mitsuki\Attributes\Route
| Parameter | Type | Description |
|---|---|---|
$name |
string |
Unique identifier for the route. |
$path |
string |
The URL pattern. |
$methods |
array|string |
Allowed HTTP methods (e.g., "GET" or ["POST", "DELETE"]). |
🤝 Contributing
If you want to add new attributes to the Mitsuki ecosystem:
- Fork the repository.
- Create your attribute class.
- Submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Maintained by [Zgenius Matondo](https://github.com/zgeniuscoders)