<?php
use Illuminate\Filesystem\Filesystem;
$rootDir = __DIR__;
$dir = $rootDir . '/fs';
$fs = new Filesystem();
$fs->makeDirectory($dir, 0775);
echo 'Directory fs created' . PHP_EOL . PHP_EOL;
$target = $dir . '/config.yml';
$fs->copy(
$rootDir . '/files/text/config.yml',
$target
);
echo $fs->get($target) . PHP_EOL . PHP_EOL;
$fs->append($target, PHP_EOL . 'append');
$fs->prepend($target, 'prepend' . PHP_EOL);
echo $fs->get($target) . PHP_EOL;
Result
Directory fs created
db.username: test, db.password: pass
prepend
db.username: test, db.password: pass
append