Basic stream implementations for PHP 5.3+