php-extended/php-file-object
Lightweight file object abstraction for PHP: immutable value objects representing files and their paths, with helpers for metadata and seamless integration into the php-extended ecosystem. Framework-agnostic, composable, and easy to use.
php-extended/php-file-interface. In practice that means an immutable, value-object style representation of a file — path, name, extension, size, and related metadata — that your business logic can type-hint against instead of SplFileInfo, Illuminate\Http\UploadedFile, or a Flysystem FileAttributes object. This supports a decision to keep attachment, media, or import/export domain code free of Laravel and Flysystem dependencies, so it survives a framework upgrade or a storage-backend swap.vfsStream, temp directories, or fixture files in a large class of tests. Supports a decision to standardize on "type-hint the interface, construct the concrete object in a factory/adapter" as an internal convention.php-extended/* family tends to split aggressively and pull sibling packages (php-collections, php-iterators, php-regex, and similar). That is a real dependency-graph cost in a Laravel app already carrying Symfony, Flysystem, and Guzzle. Supports a build-vs-buy call weighted toward "write the 50–150 lines ourselves."Adopt only if all of the following hold:
php-extended/* ecosystem and this fills a gap in an existing dependency graph you have already vetted and pinned.Look elsewhere — or write it yourself — if any of these are true:
Illuminate\Http\UploadedFile, the Storage facade, and Flysystem's FileAttributes already cover reads, writes, streams, disks, MIME detection, and cloud adapters. A parallel file abstraction here is a second source of truth that will drift.Verdict: do not add as a dependency. If the abstraction appeals, copy the interface shape into your own App\Support\Files namespace — it is a small, well-understood surface, and ownership is cheaper than an unvetted transitive dependency.
To executives: This is a tiny utility library with no users, no maintainers of note, and no security track record. It is not a platform decision and it is not a risk we need to absorb. The idea behind it — modeling files as plain, immutable objects so business logic does not care whether a file came from a browser upload, an S3 bucket, or a cron job — is sound, and we can replicate it internally in roughly a day of engineering. Recommendation: skip the dependency, take the pattern.
To engineering: The package is the concrete half of an interface/object pair: php-file-interface defines the contracts, php-file-object implements them. The value is the contract, not the implementation. Two practical outcomes. First, if we want file-handling code that is testable without touching a filesystem and portable across storage backends, we define our own narrow interface — path, name, extension, size, MIME, and a stream accessor — and type-hint that in domain services, constructing the concrete object in a thin adapter at the framework boundary. That is a genuine testability and decoupling win for the ingestion and attachment code. Second, do not composer require this: the php-extended family splits into many small sibling packages, so we would import an unfamiliar dependency tree to get a few dozen lines of value-object code, and we would own its maintenance and static-analysis story ourselves. Net: adopt the pattern, reject the package, and if anyone wants the interface text as a starting point, treat it as reference material only — write our own with our PHP version and coding standard.
How can I help you explore Laravel packages today?