yiisoft/data
yiisoft/data provides data providers, pagination, sorting, and filtering for Yii applications. A consistent API lets you read, paginate, sort, and filter data from arrays, databases, or custom sources, simplifying list and API development.
What the package is. yiisoft/data is a low-level, framework-agnostic abstraction layer for reading, writing, and processing data streams. It is essentially a set of contracts (DataReaderInterface, DataWriterInterface, DataProcessorInterface) plus a small number of iterable-backed and decorator implementations (array/iterable sources, filtering, sorting, pagination-style wrappers). It is not a Laravel package, not an application framework component, and not a data-mapping/ORM tool: there is no service provider, no facade, no config file, no Eloquent coupling, and no persistence layer.
Architecture fit. Fit is conditional and narrow. If the platform needs a stable, framework-neutral contract for "iterate a dataset → transform it → emit it" (CSV/JSON importers, scheduled exports, feed generators, ETL-ish jobs), the interface-first design composes cleanly into Laravel service classes and queued jobs without pulling in Yii's DI container or application bootstrap. If the need is anything Laravel already solves — Illuminate\Support\Collection pipelines, LazyCollection streaming, League\Csv, Illuminate\Filesystem — the package is redundant and adds an abstraction the team must maintain against two idioms. The abstraction is also thinner than it looks: value comes from the contracts, not from reusable logic, so the team will still write most reader/writer implementations itself.
Integration feasibility. Composer install is trivial and does not require Yii's framework packages; the dependency footprint appears small and PSR-friendly. It will drop into a Laravel codebase without conflict, and adoption can be scoped to one module. The real cost is not installation but ownership: any custom DataWriterInterface implementation (queues, S3, chunked CSV, database cursors) is bespoke code we own forever.
Technical risk. Low-to-moderate and mostly non-technical:
Responsable responses); teams will end up writing adapters in both directions.Key questions.
LazyCollection + League\Csv already solves?Stack fit. Compatible but idiomatically foreign. It will run fine on a modern Laravel app (PHP version constraints should be checked against our runtime), but it sits beside Laravel's conventions rather than within them. Expect to bridge: DataReaderInterface → LazyCollection for internal consumption, and Eloquent query results → IterableData for outbound pipelines.
Migration path. There is nothing to migrate away from, so treat this as a greenfield, opt-in dependency:
Compatibility. No Laravel version coupling (good). Watch PHP version constraints, PSR compliance, and whether transitive dependencies drag in other Yii packages — verify with composer why before merge. Do not allow the package to become a vector for pulling the Yii3 ecosystem into the stack.
Sequencing. Do the spike before any architecture commitment; sequence adoption after the team has standardized on LazyCollection/League\Csv so the decision is comparative, not default. If adopted, land the internal adapter layer first, then the feature that uses it — never the reverse.
Maintenance. Near-zero for the dependency itself (small, stable surface, permissive license) and non-trivial for our implementations of its contracts. Budget for periodic version bumps tied to Yii3 releases and for reviewing interface changes; because the package is small, major bumps are cheap to absorb but can be breaking in shape.
Support. Weak external support channel: no vendor SLA, low community volume, GitHub issues only. Internally this must be designated as a "vendor-by-vendoring" dependency — we own the risk. Document the pinned version and the rationale in an ADR so future maintainers know why the abstraction exists.
Scaling. Neutral to positive. Iterable-based streaming is a good fit for large datasets and constant-memory processing, which is the main technical argument in its favor for exports/imports. It does nothing for horizontal scaling, and the extra indirection adds negligible overhead per item — but on hot paths processing millions of rows, benchmark rather than assume.
Failure modes.
Ramp-up. Low for senior engineers: the concepts are simple, the API is small, and a competent developer is productive in half a day. The actual learning cost is Yii3's conventions, not yiisoft/data — so keep the package usage narrow and document the one sanctioned pattern with a working example rather than letting each team invent its own adapters.
Recommendation. Adopt selectively as an internal, swappable contract layer for streaming read/process/write pipelines where framework neutrality has real value; do not adopt it as a general-purpose data abstraction for the Laravel application. Overall risk is low and reversible; the decision hinges on the spike, not on the package's reputation.
How can I help you explore Laravel packages today?