Weave Code
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

Iter Laravel Package

nikic/iter

nikic/iter is a small PHP library for working with iterables and generators. It provides lazy, functional-style helpers like map, filter, reduce, and chain to build efficient pipelines over arrays and Traversables without extra memory overhead.

View on GitHub
Deep Wiki
Context7
v2.4.1
  • Improve typehint for toArray() from array<T> to list<T>.
v2.4.0
v2.3.0

This release adds more precise phpdoc type annotations, using templates and specifying callable signatures (#93).

v2.2.0
  • Compatibility with PHP 8.1.
v2.1.0
  • Added iter\slice() method (#80). This works like explode() but produces an iterator.
  • Added iter\mapWithKeys() method (#81). This works like iter\map() but also passes keys as second parameter to the callable.
v2.0.0

This release makes iter compatible with PHP 7.4 by renaming the iter\fn namespace to iter\func.

  • PHP >= 7.1 is now required. Functions are annotated with iterable types. (#52)
  • The iter\fn namespace has been renamed to iter\func. This is necessary for PHP 7.4 compatibility. (#79)
  • Default $preserveKeys = false in chunk() and add chunkWithKeys() function.
  • Avoid advancing by one additional iteration in slice(). (#75)
v1.6.0
  • Added iter\enumerate() function (#43).
  • Added iter\isEmpty() function (#46).
  • Added $preserveKeys parameter to iter\chunk() (#42).
v1.5.0
  • Added $levels argument for flatten().
  • Added flatMap() function.
v1.4.0
  • Fixed infinite loop when iter\zip() is called without arguments.
  • Added additional error checks for various "length" and "count" parameters (usually disallowing negative numbers).
  • The iter\flatten() function now preserves keys.
  • Added an iter\recurse() function. Example use is iter\recurse('iter\toArray', $data) which will recursively convert an iterator to array.
v1.3.0
  • Added Iterator iter\product(...$iterables):
    Returns the cartesian product iterator of the passed iterators. (#25)
  • Added bool iter\isIterable(mixed $value):
    Returns whether the value is an array or Traversable.
  • Added $key parameter to the callback of reduce() and reductions(). (#28)
  • Added support for <=> to fn\operator(). It is also supported on PHP versions that do not natively provide a <=> operator.
  • All functions now validate that inputs are iterables.
v1.2.0
  • Added new iter functions:
    • mixed search(callable $predicate, iterable $iterable):
      Returns the first value from $iterable which satisfies $predicate, or null if no such element exists.
    • Iterator reductions(callable $function, iterable $iterable, mixed $startValue = null):
      Returns an iterator which contains the intermediate values produced by applying a reduction function to an iterator. Can for example be used to compute cumulative sums.
  • Added support for the power operator (**) to iter\fn\operator(). Support is available also on older PHP versions which do not have an actual ** operator.
v1.1.0

Added iter functions:

  • Iterator mapKeys(callable $function, iterable $iterable)
  • Iterator reindex(callable $function, iterable $iterable)
  • Iterator chunk(iterable $iterable, int $size)
  • Iterator flip(iterable $iterable)
  • string join(string $separator, iterable $iterable)

Added iter\fn functions:

  • function nested_index(...$indices)
v1.0.0

First release :)

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.
yandex/translate-api
voku/simple_html_dom
league/flysystem-vfs
bkwld/upchuck
filament/spatie-laravel-tags-plugin
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php