Questions tagged [stream-wrapper]

9 questions
11
votes
2 answers

Custom stream wrapper with include or eval?

Overview I'm currently writing a template engine. It even supports multiple "format"s. Currently it can parse .php files and .tpl (specific to this engine). I'll give you a little example of both, just to give you an Idea. template.php: Name:
MarcDefiant
  • 6,649
  • 6
  • 29
  • 49
7
votes
1 answer

Using a custom stream wrapper as test stub for PHP's http:// stream wrapper

I'm writing a custom stream wrapper to use as a stub in unit tests for an HTTP client class that uses the built-in http:// stream wrapper. Specifically, I need control over the value returned in the 'wrapper_data' key by calls to…
user895378
5
votes
1 answer

Composite Stream Wrapper providing partial MemoryStream and full original Stream

Does anyone know of a composite stream solution that will pre-load the first portion of a Stream in to a MemoryStream and keep the remainder as the original Stream which will be accessed when subsequent parts are required as necessary? I should…
Gavin
  • 5,629
  • 7
  • 44
  • 86
3
votes
0 answers

PHP Stream Wrapper Meta Data

Hello, world! I need to be able to pass information from a custom stream wrapper to the code using it, but I've been having some trouble with it. The best option seemed to use stream_get_meta_data(), but I haven't been able to find a method in the…
Jonah
  • 9,991
  • 5
  • 45
  • 79
2
votes
1 answer

PHPUnit stream_wrapper_register(): Protocol var:// is already defined

I have a test suite that used to work perfectly well. It is based on FWOpenCartTest, a big descendant of PHPUnit_Framework_TestCase implementing a MVC framework (based on OpenCart). Today I had to add to such descendant a call instantiating another…
Dario Fumagalli
  • 1,064
  • 1
  • 16
  • 23
2
votes
1 answer

iterating through S3 bucket with stream wrapper

I am trying to list all the items in my Amazon S3 bucket. I have several nested directories in it. dir1/ dir1/subdir1/ dir1/subdir2/ dir1/subdir3/ dir2/ dir2/subdir1/ dir2/subdir2/ ... Each subdirectory contains several files. I need to get a…
1
vote
0 answers

Streaming mPDF Output for Download

This is more of a conceptual question, but I'm wondering if it's possible to stream the output of mPDF directly to the user in a download (e.g. without saving in a temp folder on the server or loading into the user's browser). I'm using a similar…
Lauren
  • 743
  • 3
  • 12
  • 24
0
votes
0 answers

stream wrapper and writing to php://memory results in internal server error 500

I'm trying to write a custom wrapper in PHP using the Stream Wrapper class. What I have now is pretty much simple and straight forward. class Stream { public $resource; public static function wrap() { …
Vivendi
  • 20,047
  • 25
  • 121
  • 196
0
votes
1 answer

Amazon S3 StreamWrapper fread Issue In PHP

I am using amazon s3 API and setting the client to read as stream. It is working fine for me to use file_get_contents("s3://{bucket}/{key}"), which read the full data for the file(I am using video file & testing on my local system). However, I am…
Rana
  • 5,912
  • 12
  • 58
  • 91