Doing filesystem tasks in Laravel

Code
<?php

use Illuminate\Filesystem\Filesystem;

$rootDir __DIR__;
$dir $rootDir '/fs';

$fs = new Filesystem();

$fs->makeDirectory($dir0775);
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
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8