Reputation: 1654
As question is self explanatory. And very common but how can i do with the help of symfony2 components (Filesystem).
I do not see read function in filesystem.
After lot of googles, I could not fine. Please help!
Upvotes: 5
Views: 10623
Reputation: 971
There is no function in Symfony2's Filesystem component that appends content to a file. Just use php's built in function:
file_put_contents($file, $content, FILE_APPEND);
PHP Documentation on file_put_contents
Symfony2 API for FileSystem Component
EDIT:
Since Symfony 3.3, it is possible to append content in file:
$fs = new Filesystem();
$fs->appendToFile('logs.txt', 'Email sent to [email protected]');
Upvotes: 10
Reputation: 414
Since Symfony 3.3, it is possible to append content in file:
$fs = new Filesystem();
$fs->appendToFile('logs.txt', 'Email sent to [email protected]');
Upvotes: 2