Phatso

A while back I wrote a tiny little micro framework for a contract.  It's been sitting around on my hard drive for awhile, so I figured I should throw it up here in case anybody ever has need for such a thing.

Meet Phatso.

The framework itself is only about 100 lines of code.  It handles basic dispatch and templating functionality, nothing more.  There is an auxiliary file included for PDO-based database access as well.

Phatso is intended for small web applications that could still benefit from a bit of framework-y structure.  A typical web app could probably reside in one or two PHP files.  It's not designed to be a full-fledged framework, only to provide the basic stuff (clean URLs, templates) a little web app might like to have.

 

7 Responses

  1. Sebastien Duquette Says:
    April 29, 2009 at 4:41 pm -0700

    Looks nice. While looking for the code, I wonder what you used to color the php code. Is it an html encoded file from an editor or some sort of module for the webserver ?

    ekse
  2. Judd Vinet Says:
    April 29, 2009 at 5:38 pm -0700

    Yea, it's actually done by the Apache PHP module. I just upload the file with a .phps extension and it does the rest.
  3. Achille Says:
    May 14, 2009 at 10:29 am -0700

    Good news!
    I work on small web projects for 70-80% so i like Phatso.
    Can you think to improve it with a "light" CRUD?
    Or can you send me some suggestions about how i can made it?
  4. Judd Vinet Says:
    May 15, 2009 at 7:50 am -0700

    Hi Achille,

    You can download a CRUD example here:
    http://www.zeroflux.org/proj/phatso-crud.tar.gz

    There's a .sql file included that will load some example data for you. Just import it into a MySQL DB.

    When providing multiple actions that center around a given entity, it does make sense to use classes instead of functions so that we get some sort of namespacing in effect.

    I did consider classes when first building Phatso, but decided to keep things very simple and just use functions. I may revisit this in the future, as it would be a fairly simple change to use classes instead.

    Let me know if this gets you on the right track.
  5. Achille Says:
    May 18, 2009 at 2:48 am -0700

    Hi Judd,
    thank you so much: your example is right for me.
    I want found a lot of time to spend to add some "simple" features to Phatso.
  6. Sebastien Duquette Says:
    May 30, 2009 at 10:11 am -0700

    I think I found a little (tiny) bug in phatso. On line 35 we have :
    for($i = 0; $i <= strlen($ctrl); $i++) {

    It should be $i < strlen($ctrl) , else it tries to read one character past the end of the string and a Notice is printed.
  7. Judd Vinet Says:
    May 31, 2009 at 3:20 pm -0700

    Thanks Sebastien. Fixed now.


Add Your Comment