[TYPO3-dev] streamline wrapper

Sven Wilhelm wilhelm at icecrash.com
Thu Feb 9 20:44:45 CET 2006


Hi,

just as an idea of improvement and for all that didn't know this
feature.

Starting with PHP 4.3.2 it's possible to register custom stream
wrappers. A stream wrapper is just a class that knows how to get data
from it's specified data source. A stream wrapper has to implement some
methods that PHP will call.

So nothing new till there.

Fine, it also works for include, include_once, require, require_once :)

A steam in PHP has the following style:

schema://schema-specific-form

If one like to have a statement like:

typo3://package_name/path/to/class.php

it will be possible if you register a class that handles the
schema-specifica under the scheme-name typo3.

No more statements like:

* require_once (PATH_t3lib. .....
* require_once(t3lib_extMgm::extPath('ext_key').'path/to/file.php');
* ...

Advantages?
I think so. You have just one class that has to know how to access data.
It's not necessary to have several PATH constants spread around the
system and ".... FILL IN THE ADVANTAGES YOU FIND ....".

I decided to use this style for a projects I started working on named
PHP Foundation classes. I just have to implement one class, my classpath
class, that nows where to find and how to access the data.



So, it was just a note.

Kind regards

Sven





More information about the TYPO3-dev mailing list