Live data from Hacker News

Macaw - A Simple PHP Router

github.com

41–50 of 52 posts

Re: Macaw - A Simple PHP Router

#41
post #20

Is there any pattern matching router in PHP? Just like Journey on Rails. It is faster to use Patrern Matching than sequential brute force route.

Not just a router but Epiphany[1] lets you specify a regex for routes[2]. My favorite part though is the API module which I blogged about a while back[3].

[1] https://github.com/jmathai/epiphany

[2] https://github.com/jmathai/epiphany/blob/master/examples/reg...

[3] https://trovebox.com/blog/building-trovebox-entirely-using-o...

Re: Macaw - A Simple PHP Router

#43
Great project. I personally prefer Python over PHP and use it a lot for most of the web applications. But when I must use PHP in some cases, I like frameworks like this.

For precisely this reason, I wrote a PHP router like this called Marg - http://github.com/vaidik/marg. Used it for 3 projects and I love the way I can keep things simple and sane. And that's why I appreciate this project as well.

Great to see sane projects like these in the PHP community.

Re: Macaw - A Simple PHP Router

#44
post #43

Great project. I personally prefer Python over PHP and use it a lot for most of the web applications. But when I must use PHP in some cases, I like frameworks like this. For precisely this reason, I wrote a PHP router like this called Marg - http://github.com/vaidik/marg . Used it for 3 projects and I love the way I can keep things simple and sane. And that's why I appreciate this project as well. Great to see sane p…

Sane PHP developers typically don't use global to avoid using objects properly! I only mention it because it seems you haven't given PHP a fair chance

Re: Macaw - A Simple PHP Router

#45
post #40

I don't see a composer.json in the root of the Github. Is that planned?

One problem is the library as it stands doesn't match up to composers namespacing requirements - which some php developers have decided they don't like and therefore are not going to support

Re: Macaw - A Simple PHP Router

#48
post #39

Earlier quoted context omitted.

Great! I'll get to work on these. :D

how about caching as a separate composer requirement, or do you think caching should be in a higher level in the stack?

If you can send headers with routes then I suppose you could cache with them as well. Although that could also get a bit tricky if you didn't want the routes to enclose an entire document. The typical use cases i'm thinking of would be a json route and an image route.

Probably, all a bare minimum viable url router should do is display some content based on a url or fail to an error code. I would post my own experiments with building a url router that deals with everything (because I tried it) but the end results were objectively worse than what's already been posted here... i've found that it helps to have the router, and whatever process handles rendering the document as a whole (including headers and caching) be completely separate.

Re: Macaw - A Simple PHP Router

#49
post #44
post #43

Great project. I personally prefer Python over PHP and use it a lot for most of the web applications. But when I must use PHP in some cases, I like frameworks like this. For precisely this reason, I wrote a PHP router like this called Marg - http://github.com/vaidik/marg . Used it for 3 projects and I love the way I can keep things simple and sane. And that's why I appreciate this project as well. Great to see sane p…

Sane PHP developers typically don't use global to avoid using objects properly! I only mention it because it seems you haven't given PHP a fair chance

to be fair, I've seen that idiom used quite a bit when calling database objects. It's still terrible.

Not as bad as using extract() though. Yes i'm looking at you Wordpress.

Re: Macaw - A Simple PHP Router

#50
post #13

Earlier quoted context omitted.

Well when one thing has had a viral kickstarter campaign, been on every Tech blog, and its name known by just about every developer who cares about web design. Then to hear something else named the exact same name around the same time feels kinda weird.

I've definitely never heard of your project. Not saying this to be mean, just show that not everyone has heard of it.

Not my project.
Post reply on HN