Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

BhavShashank's avatar

PHP Route

I want to know what is handler in $r->addRoute('GET', '/test', 'handler');

https://github.com/nikic/FastRoute

I am studying this and want to know how can I use this router in my project. I want to know what handler actually is. Is it a file location or its like we are referencing it to a function in a class. Like we use in codeigniter.

that /test route will trigger a function users in class named user. or something like that.

I am in way of developing a admin panel with few basic operations. And its all in procedural way. Do I need to make it into OOP and then I can use this route?

Is there any route available I can use on procedural code.

Thanks

0 likes
3 replies
Snapey's avatar

Most people have no use for such a library. Unless you are trying to deal with a specific issue, I doubt you will need it.

If you need it, you will probably be at a level where you know exactly what to do

Please or to participate in this conversation.