Re: Thinking About A PEAR Package - Looking For Comments
| From: | Paul M Jones | Date: | Mon, 07 Sep 2009 14:54:48 +0000 |
| Subject: | Re: Thinking About A PEAR Package - Looking For Comments | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-52774@lists.php.net to get a copy of this message | ||
Hi Brandon,
On Sep 6, 2009, at 12:23 , Brandon Savage wrote:
An additional reference point may be Solar_Request: - <http://svn.solarphp.com/core/trunk/Solar/Request.php> - <http://solarphp.com/class/Solar_Request> It is not fully decoupled from other Solar code, but I think the concept of the class as a whole is clear. Similarly, Zend Framework has Zend_Controller_Request: - <http://framework.zend.com/svn/framework/standard/trunk/library/Zend/Controller/RequestBrandon, At Digg I wrote a package called PHP_SuperGlobals. The main use case was so that I could mock setcookie(), as such calls were breaking unit tests (sending headers). So in your code you would do something like: $cookie = PHP_SuperGlobals::singleton('Cookie'); or $cookie = PHP_SuperGlobals::singleton('CookieMock'); $cookie->setcookie('/', 'foo'); That sort of thing. It has support for $_GET, $_POST, $_COOKIE, and I think $_SERVER. We've gotten pretty used to using it for all of those for mocking input, as well as the setcookie case. But there's a decent interface for customizing it for your needs (IMO). I'm pretty sure this is decoupled from Digg code, and would be willing to make it available if anyone has interest in it. Thoughts? Cheers, BillBill, I think that'd be great. I'd love to take a look at it, and see if it fits a good starting point. I've got a particular idea of what I'm looking for, but I'm sure this is a common problem and that *someone* has written it before. If I can avoid rewriting it, that'd be preferable.
Both Solar and Zend are PEAR-like; you may wish to include them in your future searches for functionality. -- Paul M. Jones http://paul-m-jones.com/ -- Paul M. Jones http://paul-m-jones.com/