routeSymbol is a unique name assigned to a route via the #[RespondsToHttp] attribute. Instead of using raw strings for URLs, Resonance encourages using an enum that implements HttpRouteSymbolInterface.
This approach provides:
- Consistency validation: Prevents typos in internal links.
- Bootstrap checks: Allows the framework to verify that all referenced route symbols actually exist during the server bootstrap phase.
Example implementation of a Route Symbol enum:
namespace App;
use Distantmagic//... (imports)
enum HttpRouteSymbol implements HttpRouteSymbolInterface
{
use CastableEnumTrait;
use NameableEnumTrait;
case Homepage;
}
enum HttpRouteSymbol implements HttpRouteSymbolInterface
{
use CastableEnumTrait;
use NameableEnumTrait;
case Homepage;
}