Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add run function #235

Open
coder966 opened this issue Jul 15, 2019 · 9 comments
Open

add run function #235

coder966 opened this issue Jul 15, 2019 · 9 comments

Comments

@coder966
Copy link

Hi. I would like to add a run method to start the router. This pattern (of defining the routes and then starting the router) typically exist in all the routers I know of, in Java, React, Node, etc...

This would make the library easier to start with and reduces the boilerplate code in users' code.

We can still let the user control what happens if no matching route found via passing an optional callable to the run method.

@coder966
Copy link
Author

Any thoughts ?

@mxdpeep
Copy link

mxdpeep commented Sep 14, 2019

I use basically this, $presenter is a configuration array from NEON file:

$alto = new \AltoRouter(); foreach ($presenter as $k => $v) { $alto->map($v["method"], $v["path"], $k, "route_${k}"); if (substr($v["path"], -1) != "/") { $alto->map($v["method"], $v["path"] . "/", $k, "route_${k}_x"); } }

@koenpunt
Copy link
Collaborator

Can you give an example of how that would work?

@koenpunt
Copy link
Collaborator

Oh I now see your PR

@mxdpeep
Copy link

mxdpeep commented Sep 17, 2019

Oh I now see your PR

check Tesseract LASAGNA project app.php

@rootoor225
Copy link

Hello y'all ! Knowing hop usefull os altorouter that i discovered thanks to Grafikart on YouTube via his php lessons, i Would like to Know more With a good tutorial on YouTube

@rootoor225
Copy link

Tutorial about altorouter on YouTube will ne very usefull. The creators must think to this

@ellisgl
Copy link

ellisgl commented Oct 5, 2019

Yes, a person typing typos, humming, hawing and bumbling around in a YouTube video is a great idea. Or even better, written text tutorial that can be quickly fixed and provide the info in a quicker fashion.

@rootoor225
Copy link

Hello everybody !
How am you? I'm well but a little sad.
Why? Don't worry. Just because I've spent many times on YouTube to view videos about the best simple and useful routers I ever had used: AltoRouter.
I sincerely have heard about it following Grafikart php tutorials videos.
However, he didn't spend his time on explaining profoundly this router use.
I exhort those of you guys, who are very best on teaching to make videos for teaching us, noobs, step by step, how to use altorouter. It will be very kind and good help.

Thanks and nice day to y'all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants