PHP class for text file i/o