kherge/file-manager
Strict file and stream manager for PHP: safe read/write operations with unified APIs for files, in-memory strings, and existing streams. Supports iteration over contents and consistent handling via File, Memory, and Stream managers.
Filesystem (Illuminate\Support\Facades\Storage) but offers additional features (e.g., recursive symlink resolution, Unix permissions, locking). Could complement Laravel’s Filesystem for niche scenarios.FileInterface) but lacks modern PHP features (e.g., type hints, PSR-12 compliance). Inconsistent with Laravel’s PSR standards.Storage facade bindings).FileInterface is referenced). Assumes PHP 5.6+ (Laravel 5.8+ supports PHP 7.2+).FileInterface) may conflict with Laravel’s process managers (e.g., queues, Horizon).deletePath()) could block Laravel’s event loop.FileNotFoundException); would need wrappers.Storage facade? What specific gaps does this package fill?Filesystem suffice?file_* PHP calls (e.g., file_get_contents()) with this package’s File class for consistency.Storage::disk()-> for custom file operations (e.g., CSV parsing, temp files).artisan storage:link alternatives).UploadedFile and Filesystem are better suited.File helper or Eloquent file columns instead.Storage facade (e.g., Storage::disk('local')->put() → File::write()).$this->app->bind(FileInterface::class, function ($app) {
return new File($app['path.storage'].'/app.log', 'a');
});
RuntimeException to Laravel’s FileNotFoundException).Filesystem with custom methods using this package.// app/Extensions/FileManager.php
namespace App\Extensions;
use KHerGe\File\File;
use Illuminate\Contracts\Filesystem\Filesystem;
class FileManager extends Filesystem {
public function lockFile(string $path): bool {
$file = new File($path, 'a+');
return $file->lock();
}
}
fileinfo, posix (for locking/permissions). Test on all target environments.Filesystem method at a time (e.g., lastModified() → File::getLastModified()).Filesystem if the package stagnates.debugbar).Log::channel('file_operations')->info('Locked file: '.$path);
deletePath() could block workers in queue-heavy apps.cache()->lock() for distributed locking instead of file locks.shouldQueue().| Scenario | Risk Level | Impact | Mitigation |
|---|---|---|---|
| Package abandoned | High | No security updates | Fork and maintain |
| File lock deadlock | Medium | Worker hangs | Use Redis locks + timeout |
| Permission denied | Low | Feature breaks | Fallback to Laravel’s Filesystem |
| Symlink loop | Medium | Infinite recursion | Add depth limit to recursive methods |
| PHP 8.1+ compatibility | High | Breaking changes | Polyfill deprecated functions |
Storage facade").FileNotFoundException").How can I help you explore Laravel packages today?