hanshinabingdon / linqinp
linqinp is for using something like C Sharp LINQ in php.
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/hanshinabingdon/linqinp
Requires
- php: ^8.0
Requires (Dev)
- phpunit/php-code-coverage: ^9.2
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-09-29 02:59:10 UTC
README
linqinp is for using something like C # LINQ in php.
features
- You can operate iterator by your specified callble.
- You can use not only value but also key in your making callable.
- You can modify key for return value.
dependencies
- php:^8.0.2
sample
use Linqinp\Linqinp; $target = [1, 2, 3]; // sample01 = [2, 4, 6]; $sample01 = Linqinp::from($target) ->select( function (int $value) { return $value * 2; } )->toArray(); // sample02 = [1, 4, 9]; $sample02 = Linqinp::from($target) ->select( function (int $value, int $key) { return $value * $key; } )->toArray(); // sample03 = [1 => 1, 2 => 2, 3 => 3]; $sample03 = Linqinp::from($target) ->select( function (int $value, int &$key) { $key += 1; return $value; } )->toArray();