Do you use php's default $_SESSION store, or build your own wrapper?

Curious what people prefer and why. It seems cleaner to encapsulate the session manipulation into an object, but I find directly accessing the $_SESSION global is the quickest and incurs the least overhead. Any thoughts?

I wrap Session/Post/Get/etc in an object which, during instantiation, filters each of the values via the PHP built-in filter_var function. This way, I know that input is always sanitized prior to use.

I suppose it adds some overhead, but not nearly enough to actually spend time worrying about.

The only reason I would use a wrapper (which I do) is in the event I need to work more in-depth with sessions in the future. For example, I may need to debug when a session is being set and it is not suppose to do such Another example, I may want to make $_SESSION a multi-dimensional array that corresponds to various parts of my application/website; then I could create subclasses corresponding to the different parts, etc.

It obviously adds overhead, but it is a small addition that may have your application more scalable in the future!