Joomla 4 - File::read

Skip to first unread message

Oct 1, 2021, 3:27:30 AM10/1/21
to Joomla! General Development

I'm just writing a joomla template for Joomla 4.  I remember in Joomla 3 there was a method in file called File::read - of course I know file_get_contents does pretty much the same thing but I like to use the official Joomla methods.

I noticed in the Joomla documentation Joomla 4's file class has everything except reading a file - I thought maybe it's something someone missed off the API documentation but when trying to use File::read I get an error that this method doesn't exist.

Does anyone know any reason that reading a file was taken out of the file class? Did someone just forget to implement it or was it just assumed that most people would use file_get_contents anyway or is there some other better method for reading a file?


Oct 2, 2021, 5:31:11 AM10/2/21
See in J3 file.php

@since 1.7.0
* @deprecated 4.0 - Use the native file_get_contents() instead.

Hope it helps.
> --
> You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> To view this discussion on the web, visit

Reply all
Reply to author
0 new messages