You must implement the methods exactly as described below - doing otherwise will lead to undefined behaviour.
stream_register_wrapper() allows you to implement your own protocol handlers and streams for use with all the other filesystem functions (such as fopen(), fread() etc.).