Ham

Dev tools

php microframework

SHOW HN2012

Ham

A fast PHP router/microframework I hacked up last night

github.com

#php router#php microframework#php routing#front controller

87points
63comments
#260of 1,677 in 2012
Top 16%of 2012 by points

How HN took it

CuriousMostly questions and neutral comments

2 positive, 11 neutral or asking, 2 mixed, 5 critical, out of 20 comments about the project. Thread score -0.10.

Execution: 0 for, 4 againstIdea: 2 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Simple and lightweight, easier to use than Fat Free

    From 2 comments
    • Seems much easier to use than Fat free http://fatfree.sourceforge.net/ You should evolve this into a solid/flexible micro framework.
      ittan on HN
    • Looks nice, keep it simple though. There are already a lot of feature full frameworks about that to be honest you can't compete with. I've never used a really lightweight…
      jwblackwell on HN
  • Good start for a microframework

    From 1 comment
    • Looking very good! Definitely a nice start. Made me think of this MVC project: http://www.phpro.org/tutorials/Model-View-Controller-MVC.html
      dutchbrit on HN

Objections

  • Regex routing is slow and O(n)

    From 2 comments
    • ``` Routes are converted to regex and cached so this process does not need to happen every request. ``` But, regex will again degrade performance.
      johnx123-up on HN
    • I wouldn't call that computationally efficient. It is possible to make routing an O(log n) operation; your routing solution, like all routers that use regexes directly, is O(n).
      orlandu63 on HN
  • Closure caching not supported without XCache; error handling incomplete

    From 2 comments
    • I tried the example but ran with some issues. Maybe you could specify the requirements ? 1/ It needs PHP >= 5.3 I guess (anonymous functions ?). 2/ It needs APC (use of…
      conradfr on HN
    • Great work. Hope to see this evolve into a great little toolset. I have gone through your code a bit and think that you should consider error handling first. Some methods return…
      hendrik-xdest on HN
  • Too close to Silex and Slim

    From 2 comments
    • You basically ripped off Silex http://silex.sensiolabs.org/
      Jebus on HN
    • Following the feature set of http://www.slimframework.com/ at all?
      nerdfiles on HN

Requests

  • Named regex captures in routes

    From 1 comment
    • Looks good. I'd use named regex matches for the routes (like in Django) to make routes more flexible, ie. !/path/(?P<id>[0-9]{1,5}_(?P<kw>[a-z0-9_]{5,20})! etc.
      yaix on HN
  • Add a license

    From 1 comment
    • Can you tell us about the License for use? I do not see the license info.
      narad on HN
  • Better error handling and tests/docs

    From 2 comments
    • Great work. Hope to see this evolve into a great little toolset. I have gone through your code a bit and think that you should consider error handling first. Some methods return…
      hendrik-xdest on HN
    • Yep, that's cool, I mainly made it for personal use so I'm not too bothered if others don't use it! I need to start writing tests and docs really, but as I said, it was something…
      antihero on HN

Questions

  • How does it compare to Klein.php

    From 1 comment
    • I hate to be That Guy, but how does this compare to klein.php [1]? [1] https://github.com/chriso/klein.php
      damncabbage on HN
  • Is the route cache stale when routes change

    From 1 comment
    • Am I reading this correctly that currently the route results will stay cached for the caches TTL? So if you change a route to have a different callback in your main program it…
      lonnyk on HN

Alternatives named

  • Slim Framework

    From 2 comments
    • I'd prefer Slim Framework ( http://www.slimframework.com/ ) combined with RedBean ORM and H2O Template.
      buchin on HN
    • Following the feature set of http://www.slimframework.com/ at all?
      nerdfiles on HN
  • Fat Free

    From 1 comment
    • Seems much easier to use than Fat free http://fatfree.sourceforge.net/ You should evolve this into a solid/flexible micro framework.
      ittan on HN
  • Klein.php

    From 1 comment
    • I hate to be That Guy, but how does this compare to klein.php [1]? [1] https://github.com/chriso/klein.php
      damncabbage on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/3728360)