Home > Tech > My PHP crap, anyone interested?

My PHP crap, anyone interested?

November 21st, 2008

I’ve been working on my own PHP-based project for a month or so, and have rewritten some basic generic libraries from scratch in PHP. I’m pondering whether I should open source them, and would appreciate it if you would comment on this post if you’re interested in seeing me put in the effort to write docs, standardize, then toss specific portions or all of it online. I learned my lesson through Freetag; it takes a lot of energy to keep something maintained. Here’s some of what I have:

  • A database wrapper singleton around PDO
    • Simplifies code for working with “prepared statements” DBI-style. PDO prepared statements work great for getting around SQL injection, but I found them cumbersome by nature.
    • Consolidated error and exception handling with custom callback support.
    • I’ll eventually add fancier stuff in here, such as handle splitting for replicated architectures in here, and some read-after-write consistency code.
  • A simple nonce library for protecting against XSRF/CSRF
  • A simple library for handling file and image upload/resize
  • A simple code profiling utility
  • Some validation routines (I would like to add in some self-documenting API neatness that I wrote about before, when I get some time)
  • Some other random handy stuff, like arg signing, link building, human interval descriptions.

It’s all pretty consistent with my philosophy of abstracting away website-related functionality instead of architecture. With this set of limited libraries, i’m building at a pretty fast rate, and I can almost always figure out what’s going on by just looking at one or two files. I’m trying to get a nice foundation that I can build fairly serious stuff on top of without getting completely confused.

Oh, and it all depends on php/filter being enabled with a default filter of “special_chars”. Come to think of it, I might write a separate post about using that, because it’s handy.

Tech

  1. November 30th, 2008 at 05:36 | #1

    Before I was interrupted I had just started throwing stuff on a public svn repository and slapping a GPLv3 on it, which worked OK. I’m trying out github now (http://github.com/lhl/), which I think would might work out better since it’s more convenient to have multiple Git projects and it’s pretty trivial to make them public (vs svn where juggling multiple repositories is sort of a pain).

    Anyway, I’d be interested in seeing what you’ve been working on, although whether I’d use it I guess would depend on whether I settle into Django or not (haven’t been feeling it after poking for the past few months but want to do at least a couple bigger projects before I decide).

  1. No trackbacks yet.