donut/capture_buffer

0.1.0 2014-08-19 03:58 UTC

README

Capture output buffer from PHP script.

Installation

capture_buffer lives on packagist.org

$ composer require donut/capture_buffer

Usage

<?php require "vendor/autoload.php";

$out = \Donut\Util\capture_buffer($filename);

API

capture_buffer( string $filename )

Uses PHP ob_start and ob_get_clean to capture buffer of a required script.

Example

donut.php

<?php echo "donuts!";

example.php

<?php

$buffer = capture_buffer("donut.php");

var_dump($buffer);

Output

string(7) "donuts!"

Attribution

License

BSD 3-Clause