Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filesystem Laravel Package

fidry/filesystem

A tiny wrapper around Symfony Filesystem offering a FileSystem interface and utilities for path escaping, real and normalized paths, and temporary files and directories, including support for custom stream wrappers.

View on GitHub
Deep Wiki
Context7

Symfony Filesystem with a few more utilities.

Frequently asked questions about Filesystem
How do I install fidry/filesystem in a Laravel app?
Install it with Composer using composer require fidry/filesystem. The package is framework-agnostic, so you can use its FileSystem implementation directly or bind the FileSystem interface in a Laravel service provider for dependency injection. It leans on Symfony Filesystem, which Laravel already pulls in, so dependency resolution is usually straightforward.
Is fidry/filesystem compatible with Laravel 11 and Laravel 12?
Yes. fidry/filesystem 2.0.1 keeps Symfony 7 support and adds Symfony 8 support, so it fits Laravel 11 and Laravel 12 today and is positioned for the next Laravel major. On PHP 8.2 or 8.3, Composer will typically resolve Symfony 7; on PHP 8.4 it may resolve Symfony 8. Confirm the constraint is a union such as ^7.0 || ^8.0 rather than a hard ^8.0 bump.
What is the difference between fidry/filesystem and Laravel's Storage facade?
Laravel's Storage facade is a higher-level Flysystem abstraction with drivers for local and cloud disks such as S3. fidry/filesystem is a thin wrapper around Symfony Filesystem focused on local operations plus path and temporary file utilities. It does not provide cloud storage, so use it alongside Storage rather than as a replacement.
How do I create a temporary file or directory with a custom prefix in PHP or Laravel?
Use tmpFile($prefix, $suffix, $targetDirectory) for files and tmpDir() for directories. Both default to the system temporary directory and produce consistent names, and tmpFile supports custom prefixes, suffixes and stream wrappers. This is handy for build artifacts, sandboxed test fixtures or short-lived exports. Remember that these are local temporary paths, not Laravel storage disks.
How does escapePath handle Windows and Unix path separators?
escapePath() replaces directory separators with the system convention, so C:/path/to/file becomes C:\path\to\file on Windows. realPath() returns an absolute path without normalization, while normalizedRealPath() returns an absolute normalized path. Use normalizedRealPath() when you need stable, comparable path strings across platforms.
Can fidry/filesystem use custom stream wrappers for temporary files?
Yes. tmpFile() and tmpDir() support custom stream wrappers by accepting a target directory that uses a wrapper scheme. That lets you create temporary files in virtual or in-memory filesystems instead of only the system temp directory. The behavior follows Symfony Filesystem's stream wrapper handling, so verify your wrapper supports the operations you need.
What testing utilities does fidry/filesystem provide for Laravel tests?
The package provides FileSystemTestCase, SplFileInfoFactory and SplFileInfoBuilder to simplify file-heavy unit and integration tests. They can reduce boilerplate when testing migrations, exports or other workflows that touch the filesystem. If your team already relies on Laravel's Storage::fake() and built-in mocking, evaluate whether these helpers add enough value before adopting them broadly.
Does fidry/filesystem work in production or is it only for testing?
It is usable in production for local filesystem work such as resolving real paths, escaping separators and creating temporary files or directories. It is not a cloud storage layer and does not replace Laravel's Storage facade for S3 or other remote disks. Ensure the target temp directory is writable and that your application cleans up temporary artifacts.
What are alternatives to fidry/filesystem for filesystem operations in Laravel?
Common alternatives are Symfony Filesystem directly, Laravel's Storage facade with Flysystem, and the Illuminate\Support\Facades\File API. fidry/filesystem adds a FileSystem interface plus path and temp utilities on top of Symfony Filesystem. Choose it when those helpers or testing utilities matter more than cloud storage support.
Is fidry/filesystem actively maintained and does it support Symfony 8?
The 2.0.1 release adds Symfony 8 support while retaining Symfony 7, with no breaking changes or new API. It is a drop-in patch upgrade from 2.0.0, but adding a new upstream major in a patch release is a semver smell, so read the changelog on each bump. Adoption is still minimal, so validate that its utilities fill a real gap in your stack.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource