if you want to add or append information or data to a file using php, you can with the fopen() fucntion

you can add more content or data at the top or begining of the file with the fopen command and using W+

if you want to know more visit this post:

example-of-how-to-use-fopen-function-in-php-write-to-files