fidry/filesystem
Tiny wrapper around Symfony Filesystem providing a FileSystem interface plus handy extras: path escaping for OS separators, real/normalized real path helpers, and consistent temp file/dir creation (incl. custom stream wrappers).
escapePath, realPath, normalizedRealPath), temporary file/directory utilities (tmpFile, tmpDir), and read-only filesystem modes—useful for testing, sandboxing, or security-sensitive operations.FileSystemTestCase, SplFileInfoFactory, and SplFileInfoBuilder simplify unit/integration testing, especially for file-heavy workflows (e.g., migrations, exports).Storage facade, FilesystemManager).tmpFile/tmpDir may duplicate Laravel’s storage_path() + tempnam() patterns. Assess redundancy before adoption.createMock()).FileSystem interface can be bound to Laravel’s IoC, replacing or extending Symfony’s Filesystem component.FS static class could wrap a facade (e.g., Filesystem::class), though static usage is discouraged in Laravel.Storage facade for filesystem operations, but lacks cloud storage (S3, etc.) support—unlike Flysystem.FileSystemTestCase, SplFileInfoBuilder) before rolling out core filesystem methods.SplFileInfo::getContents()), but Laravel’s Storage facade already mitigates this via read().escapePath) may conflict with Laravel’s str() helpers or Path facade.tmpFile/tmpDir could clash with Laravel’s storage_path('app') or sys_get_temp_dir() patterns.createFinder() extends Symfony’s Finder, but Laravel’s Illuminate\Support\Facades\File uses a different API.SplFileInfo builders may require refactoring existing mocks in test suites.escapePath/realPath could introduce inconsistencies if not uniformly applied across the codebase.ReadOnlyFileSystem may not align with Laravel’s eager-loading or caching behaviors.Storage facade, File helper, or Path facade already cover 80% of the package’s utility?FileSystemTestCase/SplFileInfoBuilder reduce test maintenance costs significantly?escapePath) a recurring issue in your deployment pipeline?SplFileInfo with SplFileInfoBuilder/SplFileInfoFactory.escapePath/realPath in CLI commands or deployment scripts.ReadOnlyFileSystem for read-heavy operations (e.g., analytics, reporting).tmpFile/tmpDir for large file processing (e.g., exports, backups).FileSystem interface to a concrete implementation (e.g., NativeFileSystem or a custom wrapper).FS static class for one-off filesystem tasks.createFinder() for file-watching logic (e.g., filesystem.updated events).Storage facade for the same operations (e.g., use Storage::disk()->exists() instead of isReadable()).FS static class in production code; prefer dependency injection.SplFileInfo mocks in tests with SplFileInfoBuilder.FileSystemTestCase for file-heavy test suites (e.g., migrations, imports).Filesystem component with Fidry\FileSystem\FileSystem in service bindings.escapePath/realPath for cross-platform consistency.ReadOnlyFileSystem for read-only operations (e.g., API responses, cached data).tmpFile/tmpDir for temporary file operations in jobs/queues.Filesystem component, with added methods.readFile() may shadow Laravel’s Storage::read() if not namespaced carefully.escapePath doesn’t conflict with Path::make() or str() helpers.Storage:: methods for disk operations to avoid duplication.ext-mbstring (fixed in v1.2.2+), which is enabled by default in Laravel.| Priority | Task | Dependencies |
|---|---|---|
| High | Replace SplFileInfo mocks in tests with SplFileInfoBuilder. |
None |
| High | Bind FileSystem interface to Laravel’s IoC. |
Symfony Filesystem component |
| Medium | Update path-handling logic to use escapePath/realPath. |
Cross-platform path issues identified |
| Low | Replace tempnam() with tmpFile/tmpDir in jobs/commands. |
Existing temp file logic |
| Low | Implement ReadOnlyFileSystem for read-heavy operations. |
Testing validation |
SplFileInfoBuilder) cut down on mock setup time.escapePath/realPath reduce path-related bugs in deployments.composer.json and CI pipelines.SplFileInfo::getContents()) are deprecated; monitor Laravel’s alignment.Storage adapters (e.g., S3, FTP).tmpFile/tmpDir could strain disk I/O under high concurrency (e.g., bulk exports).How can I help you explore Laravel packages today?