php-standard-library/iter
Inspect and reduce any PHP iterable (arrays, generators, iterators) with small, focused helpers from PHP Standard Library - Iter. Designed for common iteration tasks and consistent behavior across iterable types.
IteratorAggregate models).collect()-like operations but with lazy evaluation).symfony/collection, league/collection).iterable return types, named arguments) that Laravel 10+ supports natively.Mockery, Pest).artisan commands).map operations). Mitigated by clear error messages and stack traces.Generator + ArrayObject) may need explicit type hints or runtime checks, adding minor complexity.foreach loops. Documentation and PHPDoc annotations can offset this.symfony/collection, spatie/array-to-object) that overlap, and how does this compare?Collection for common operations (e.g., map, filter) in terms of memory and speed?assertEquals for iterables)?Illuminate\Support\Collection for lazy operations (e.g., iter()->map() vs. Collection::map()).Model::cursor() + iter()->filter()).Resource::collection() with lazy pipelines).iter()->chunk() for batch jobs).@foreach(iter($items)->filter(...))).spatie/array-to-object, league/glide (image processing), or spatie/laravel-medialibrary (file iteration).symfony/collection unless Symfony’s features (e.g., IteratorAggregate) are explicitly needed.foreach loops with iter() pipelines in new features.Collection::map() with iter()->map() for lazy operations.iter() with Model::cursor() for large datasets (e.g., exports, audits).Resource classes for nested data (e.g., iter($posts)->map(fn($p) => new PostResource($p))).LaravelIterServiceProvider to bind iter() as a global helper (optional).iter() pipelines.foreach ($items as $item) with iter($items)->foreach(...)").iterable type hints).iter() may leverage SPL (Standard PHP Library) iterators under the hood.DB::select() generators).iter()->cache() for memoization).php-standard-library/iter to composer.json and publish as a project dependency.app('iter')) for global access.Resource classes and API controllers.artisan commands (e.g., make:report).tests/Feature/IterationPipelinesTest).iter($generator)->toArray()).composer.json until stability is confirmed (e.g., ^1.0).ArrayObject).iter()->map()->filter() errors).iter()->tap(fn($i) => Log::debug($i))).iter()->chunk(1000) vs. Collection::chunk(1000)).iter()->remember() with Laravel’s cache).foreach with iter()").iter()->chunk() across queue workers).iter() for Model::all() vs. eager loading).DB::table()->cursor()).iter($response->json())).iter()->take(1000)).How can I help you explore Laravel packages today?