Re: [Proposal] Stream_Var

From: Date: Fri, 15 Aug 2003 23:14:17 +0000
Subject: Re: [Proposal] Stream_Var
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-19854@lists.php.net to get a copy of this message
Hey, This seems to me to be a (slightly modified) re-publication of the example wrapper I wrote for the manual/test-suite. As such, I would appreciate a credit in the code. Now, as to the proposal, I'm not 100% convinced of the utility of this (despite writing the original example!), so I am -0 on adding this. --Wez. On Fri, 15 Aug 2003, Stephan Schmidt wrote: > Hi PEAR-Devs, > > I'd like to propose a new package called Stream_Var. This package allows > stream based access to variables using the stream wrappers that have > been introduced in PHP4.3.2 > > That means you can do things like: > > $fp = fopen('var://GLOBALS/anyGlobalVar', 'r'); > > and then use fread, fwrite, fseek, etc. on this filepointer to read from > and modify the variable. It supports GLOBALS, GET, POST, etc. > If 'anyGlobalVar' is an array, it behaves like a directory, that means > you could do the following: > > $fp = fopen('var://GLOBALS/anyGlobalVar/anyKey', 'r'); > > of course with an unlimited depth :-) > > As arrays are directories, also the following is possible: > > $dir = opendir('var://GET'); > while($entry = readdir($dir)) { > echo "$entry<br />"; > } > > I still need to implement some minor things like different file modes > (r,r+,w,w+,a,...) and options so it's possible to trigger errors, that > give more detail, but the basic functionality is included. > @Greg: Yes, I know that I still have to include some inline > documentation, on which problem it does solve :-) I'll do that before > the first version is released. > > You can take a look at the sourcecode at: > http://www.php-tools.de/PEAR/Stream_Var/Var.phps > > Download it, with examples from: > http://www.php-tools.de/PEAR/Stream_Var/Stream_var.zip > > You can also take a look at the sourcecode of the examples at: > http://www.php-tools.de/PEAR/Stream_Var/examples/example.phps > http://www.php-tools.de/PEAR/Stream_Var/examples/example2.phps > > The will not work on this server, as PHP4.3.2 is not installed :-( (I > already informed the hoster), but you can download the zip and test it > on your local machine. > > So please send your feedback and comments, so I can include this in PEAR > as soon as possible :-) > > Best regards, > > Stephan

« previous php.pear.dev (#19854) next »