diff --git a/components/filesystem.rst b/components/filesystem.rst index 6386fad4bbb..a1d0ad55a64 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -283,6 +283,20 @@ complete new file (but never a partially-written file):: The ``file.txt`` file contains ``Hello World`` now. +appendToFile +~~~~~~~~~~~~ + +.. versionadded:: 3.3 + The :method:`Symfony\\Component\\Filesystem\\Filesystem::appendToFile` method was introduced in Symfony 3.3. + +:method:`Symfony\\Component\\Filesystem\\Filesystem::appendToFile` adds new +contents at the end of some file:: + + $fs->appendToFile('logs.txt', 'Email sent to user@example.com'); + +If either the file or its containing directory doesn't exist, this method +creates them before appending the contents. + Error Handling --------------