File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,22 @@ contents at the end of some file::
313313If either the file or its containing directory doesn't exist, this method
314314creates them before appending the contents.
315315
316+ ``readFile ``
317+ ~~~~~~~~~~~~
318+
319+ .. versionadded :: 7.1
320+
321+ The ``readFile() `` method was introduced in Symfony 7.1.
322+
323+ :method: `Symfony\\ Component\\ Filesystem\\ Filesystem::readFile ` returns all the
324+ contents of a file as a string. Unlike the :phpfunction: `file_get_contents ` function
325+ from PHP, it throws an exception when the given file path is not readable and
326+ when passing the path to a directory instead of a file::
327+
328+ $contents = $filesystem->readFile('/some/path/to/file.txt');
329+
330+ The ``$contents `` variable now stores all the contents of the ``file.txt `` file.
331+
316332Path Manipulation Utilities
317333---------------------------
318334
You can’t perform that action at this time.
0 commit comments