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

Php File Object Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Domain-layer file modeling without framework coupling. The package supplies concrete implementations for the contracts in 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.
  • Testability via interface/object split. Because consumers depend on the interface package and instantiate the object package only at the edges, every unit test touching file handling can double the interface. This is the strongest argument for the pattern: it removes the need for 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.
  • Boundary normalization for multi-source ingestion. If your product takes files from web uploads, SFTP drops, S3 syncs, and CLI imports, a neutral file value object is a reasonable canonical form to normalize into before validation, dedupe, or virus-scan orchestration. Supports build-vs-buy scoping for an ingestion pipeline.
  • Roadmap signal — mostly negative. Zero stars, zero dependents, and a low opportunity score mean no product surface is being built on this today. It does not support a roadmap decision to adopt; it supports a decision to not spend roadmap time on it and instead treat it as a design reference (see the pitch section).
  • Composer surface as a decision input. The 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."

When to Consider This Package

Adopt only if all of the following hold:

  • You are already inside the php-extended/* ecosystem and this fills a gap in an existing dependency graph you have already vetted and pinned.
  • Your codebase targets the PHP versions this package supports and you can accept its typing style — this family predates modern PHP union/intersection types and leans on docblocks and interfaces rather than native type declarations, which will feel dated next to PHP 8.2+ code.
  • You genuinely need an interface-first file abstraction and have no framework-provided equivalent in the relevant layer. If the code lives in a Laravel controller, job, or console command, you already have one.
  • You have reviewed the transitive dependency list, confirmed no version conflicts with Laravel/Symfony, and accepted the supply-chain review burden for an unmaintained package.

Look elsewhere — or write it yourself — if any of these are true:

  • You are a Laravel application. 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.
  • You handle large or streamed files. Value-object file models that carry content or eagerly compute size/hash are a poor fit for multi-gigabyte uploads and will push you back to streams anyway.
  • You need maintenance guarantees. Zero stars and zero dependents means no community CVE triage, no downstream pressure to fix bugs, and an effective bus factor of one. For anything on a security or compliance path (PII handling, upload validation, storage of customer documents), that is disqualifying on its own.
  • You need modern static analysis. With no adoption, there is no PHPStan/Psalm baseline, no IDE plugin support, and no Stack Overflow corpus. Your team absorbs the entire learning and debugging cost.
  • You need cloud storage, chunked uploads, image processing, or virus scanning. None of that is in scope for an interface/object pair; you will be integrating those yourself regardless.

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.

How to Pitch It (Stakeholders)

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.

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
shitoudev/permissionmanager