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

Technical Evaluation

Architecture Fit

2.0.1 delta: Adds Symfony 8 support (#67). No breaking changes, no deprecations, no API additions. This is a dependency-compatibility release that materially changes the package's forward-compatibility profile and its versioning story.

  • Pros:
    • Symfony Filesystem Compatibility: Aligns seamlessly with Laravel’s existing dependency on Symfony’s filesystem component, reducing friction in integration.
    • Symfony 8 Forward Compatibility (new): The package now tracks the next Symfony major, so it will not become a blocker when Laravel’s underlying Symfony constraint advances. This directly retires the previously open “will this survive Symfony 8?” risk item.
    • Dual-Major Support (new): Widening the constraint (presumably ^7.0 || ^8.0) means a single package version serves Laravel 11/12 today (Symfony 7) and the next Laravel major (Symfony 8) without a coordinated upgrade — valuable for multi-app or multi-version monorepos.
    • Extended Functionality: Adds cross-platform path handling (escapePath, realPath, normalizedRealPath), temporary file/directory utilities (tmpFile, tmpDir), and read-only filesystem modes—useful for testing, sandboxing, or security-sensitive operations.
    • Testability: FileSystemTestCase, SplFileInfoFactory, and SplFileInfoBuilder simplify unit/integration testing, especially for file-heavy workflows (e.g., migrations, exports).
    • Backward Compatibility: Maintains Symfony 7 support alongside the new Symfony 8 support; PHP floor appears unchanged (verify), so existing Laravel 11/12 installs are unaffected.
  • Cons:
    • Minimal Adoption: Still no dependents; validate if the package’s utilities address gaps in Laravel’s ecosystem (e.g., Storage facade, FilesystemManager).
    • Overlap with Laravel: Features like tmpFile/tmpDir may duplicate Laravel’s storage_path() + tempnam() patterns. Assess redundancy before adoption.
    • Testing Focus: Heavy emphasis on testing utilities may not justify inclusion if your team uses Laravel’s built-in testing tools (e.g., createMock()).
    • Feature Shipped in a Patch (new): Adding a new supported upstream major in a 2.0.1 patch is a semver-smell. It signals relaxed release discipline — treat the version number as advisory and read the changelog on every bump rather than assuming patch = safe.

Integration Feasibility

  • Laravel Stack Fit:
    • Service Container: The FileSystem interface can be bound to Laravel’s IoC, replacing or extending Symfony’s Filesystem component.
    • Facade Potential: The FS static class could wrap a facade (e.g., Filesystem::class), though static usage is discouraged in Laravel.
    • Storage Integration: Works alongside Laravel’s Storage facade for filesystem operations, but lacks cloud storage (S3, etc.) support—unlike Flysystem.
    • Version Resolution (new): On a Laravel 12 / PHP 8.2–8.3 host, Composer will resolve Symfony 7; on a PHP 8.4 host it may resolve Symfony 8. Confirm the constraint is a union and not a hard ^8.0 bump, which would silently drop Laravel 11/12 support.
  • Migration Path:
    • Incremental Adoption: Start with testing utilities (FileSystemTestCase, SplFileInfoBuilder) before rolling out core filesystem methods.
    • Deprecation Handling: Some methods are deprecated (e.g., SplFileInfo::getContents()), but Laravel’s Storage facade already mitigates this via read().
    • Upgrade Path (new): Adopting 2.0.1 is a drop-in patch upgrade from 2.0.0 — no code changes required. The only decision is whether to pin the Symfony major in the lockfile.
  • Compatibility Risks:
    • Path Handling: Cross-platform path normalization (escapePath) may conflict with Laravel’s str() helpers or Path facade.
    • Temporary Files: tmpFile/tmpDir could clash with Laravel’s storage_path('app') or sys_get_temp_dir() patterns.
    • Finder Integration: createFinder() extends Symfony’s Finder, but Laravel’s Illuminate\Support\Facades\File uses a different API.
    • Dual-Major Drift (new): Code that behaves identically on Symfony 7 may not on Symfony 8 (filesystem exception types, deprecations, Finder internals). Dev/prod environments running different PHP versions may silently exercise different Symfony majors.

Technical Risk

  • High:
    • Testing Overhead: Custom SplFileInfo builders may require refactoring existing mocks in test suites.
    • Path Normalization: escapePath/realPath could introduce inconsistencies if not uniformly applied across the codebase.
    • Read-Only Mode: ReadOnlyFileSystem may not align with Laravel’s eager-loading or caching behaviors.
  • Medium:
    • Dependency Bloat: Adding this package for testing utilities alone may not justify the footprint.
    • Maintenance Burden: Active development is a plus, but Laravel’s ecosystem evolves independently.
    • Environment Matrix Divergence (new): Confirm the package’s CI actually runs both Symfony 7 and Symfony 8 legs. A union constraint without a matching test matrix is a promise, not a guarantee. Verify before relying on Symfony 8 in production.
  • Low:
    • License: BSD-3-Clause is Laravel-compatible.
    • Performance: Minimal overhead; utilities are lightweight wrappers.
    • Symfony 8 Slippage (downgraded from Medium): Previously a forward-compatibility unknown; now explicitly addressed.

Key Questions

  1. Does this solve a critical gap?
    • Are there pain points in Laravel’s filesystem handling (e.g., cross-platform path issues, testing complexity) that this package addresses?
  2. Redundancy Check:
    • Does Laravel’s Storage facade, File helper, or Path facade already cover 80% of the package’s utility?
  3. Testing ROI:
    • Will FileSystemTestCase/SplFileInfoBuilder reduce test maintenance costs significantly?
  4. Cross-Platform Needs:
    • Is path normalization (escapePath) a recurring issue in your deployment pipeline?
  5. Long-Term Viability — largely answered by 2.0.1:
    • Symfony 8 support is now in place. Remaining question narrows to cadence: how quickly will the maintainer absorb Symfony 9 and future Laravel majors, and is there a documented support window?
  6. New — Constraint Shape:
    • Is the declared constraint ^7.0 || ^8.0, or did 2.0.1 replace ^7.0 with ^8.0? The latter would break Laravel 11/12 installs despite the patch version.
  7. New — Was Symfony 6 intentionally dropped?
    • If the previous constraint included Symfony 6, its removal is a BC break mislabeled as a patch feature and affects older Laravel installs.

Integration Approach

Stack Fit

  • Primary Use Cases:
    • Testing: Replace manual mocks for SplFileInfo with SplFileInfoBuilder/SplFileInfoFactory.
    • Cross-Platform Paths: Use escapePath/realPath in CLI commands or deployment scripts.
    • Sandboxing: ReadOnlyFileSystem for read-heavy operations (e.g., analytics, reporting).
    • Temporary Files: tmpFile/tmpDir for large file processing (e.g., exports, backups).
  • Laravel-Specific Synergies:
    • Service Provider: Bind the FileSystem interface to a concrete implementation (e.g., NativeFileSystem or a custom wrapper).
    • Artisan Commands: Leverage FS static class for one-off filesystem tasks.
    • Events/Listeners: Use createFinder() for file-watching logic (e.g., filesystem.updated events).
  • Anti-Patterns:
    • Avoid mixing this package with Laravel’s Storage facade for the same operations (e.g., use Storage::disk()->exists() instead of isReadable()).
    • Do not use FS static class in production code; prefer dependency injection.
    • Do not let Symfony majors differ between dev and prod — pin and verify.

Migration Path

  1. Phase 0: Verify the 2.0.1 Constraint (new)
    • Inspect composer.json for the symfony/filesystem and php constraints.
    • Confirm both ^7.0 and ^8.0 are permitted and that Symfony 6 removal (if any) does not affect your Laravel version.
    • Run composer why symfony/filesystem on your target hosts before upgrading.
  2. Phase 1: Testing Utilities
    • Replace SplFileInfo mocks in tests with SplFileInfoBuilder.
    • Adopt FileSystemTestCase for file-heavy test suites (e.g., migrations, imports).
  3. Phase 2: Core Functionality
    • Replace Symfony’s Filesystem component with Fidry\FileSystem\FileSystem in service bindings.
    • Update path-handling logic to use escapePath/realPath for cross-platform consistency.
  4. Phase 3: Advanced Features
    • Implement ReadOnlyFileSystem for read-only operations (e.g., API responses, cached data).
    • Use tmpFile/tmpDir for temporary file operations in jobs/queues.

Compatibility

  • Symfony Filesystem:
    • Drop-in replacement for Symfony’s Filesystem component, now spanning Symfony 7 and 8.
    • Laravel mapping: Laravel 11/12 → Symfony 7; a future Laravel major → Symfony 8. Confirm your target Laravel version is supported against both.
    • PHP floor caveat: Symfony 8 requires PHP 8.4. A team on PHP 8.2 will stay on Symfony 7 regardless of the package constraint — the new support is latent until you upgrade PHP.
    • Conflict Risk: Methods like readFile() may shadow Laravel’s Storage::read() if not namespaced carefully.
  • Laravel-Specific:
    • Path Facade: Ensure escapePath doesn’t conflict with Path::make() or str() helpers.
    • Storage Facade: Prefer Storage:: methods for disk operations to avoid duplication.
  • PHP Extensions:
    • Requires ext-mbstring (fixed in v1.2.2+), which is enabled by default in Laravel.

Sequencing

Priority Task Dependencies
High Verify 2.0.1 constraint is a Symfony 7/8 union, not a hard ^8.0. None
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
Medium Align PHP version across dev/CI/prod to avoid Symfony-major drift. Host/PHP upgrade plan
Low Replace tempnam() with tmpFile/tmpDir in jobs/commands. Existing temp file logic
Low Implement ReadOnlyFileSystem for read-heavy operations. Testing validation

Operational Impact

Maintenance

  • Pros:
    • Reduced Boilerplate: Testing utilities (SplFileInfoBuilder) cut down on mock setup time.
    • Cross-Platform Safety: escapePath/realPath reduce path-related bugs in deployments.
    • Active Development: Maintainer absorbed a new upstream major promptly (#67), evidencing responsiveness on dependency churn — the single biggest maintenance risk for a thin wrapper package.
    • Lower Upgrade Cost (new): The package is now de-risked against the next Symfony major, removing one future migration ticket from the backlog.
  • Cons:
    • Additional Dependency: Adds complexity to composer.json and CI pipelines.
    • Doubled Test Surface (new): Two supported Symfony majors means the maintainer must validate both; gaps surface as runtime defects on whichever leg you happen to run. Treat the Symfony 8 path as less battle-tested until proven.
    • Testing Overhead: Custom test utilities may require documentation and onboarding.
    • Deprecation Risk: Some methods (e.g., SplFileInfo::getContents()) are deprecated; monitor Laravel’s alignment.

Support

  • Pros:
    • Community: BSD-3-Clause license encourages contributions; GitHub issues can be raised.
    • Documentation: README and test examples provide clear usage patterns.
    • Upstream Responsiveness (new): Symfony 8 support landed before Laravel has shipped a Symfony 8–based release — ahead of the consumer curve, which is the correct posture for an infrastructure package.
  • Cons:
    • Limited Adoption: No dependents may imply niche support scenarios; a low-traffic issue tracker means less collective debugging of the Symfony 8 leg.
    • Laravel-Specific Gaps: No built-in support for Laravel’s Storage adapters (e.g., S3, FTP).

Scaling

  • Performance:
    • Minimal Impact: Utilities are lightweight wrappers; no significant overhead expected.
    • Temporary Files: tmpFile/tmpDir could strain disk I/O under high concurrency (e.g., bulk exports).
    • No Change from 2.0.1: This release is dependency-only; no runtime, memory, or concurrency characteristics change.
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.
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk