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 Grouper

Php Grouper Laravel Package

leovie/php-grouper

leovie/php-grouper is a lightweight PHP utility for organizing arrays and collections into groups using custom rules. It offers a simple API for defining grouping logic and retrieving grouped results, helping keep data-processing code clean and readable.

View on GitHub
Deep Wiki
Context7

Group PHP-objects by different criteria

Frequently asked questions about Php Grouper
What is leovie/php-grouper and what problem does it solve?
leovie/php-grouper is a lightweight, framework-agnostic PHP utility that partitions arrays or collections of objects into groups using custom criteria such as a key name, closure, or callable. It keeps grouping logic centralized and readable inside services, jobs, exporters, or collection pipelines. It is not an Eloquent or Laravel-specific package; it is a leaf Composer dependency that you call directly from your application code.
How do I install leovie/php-grouper in a Laravel app?
Install it with composer require leovie/php-grouper. There is no service provider, facade, config publishing, or migration step, so you can invoke it from a service, job, exporter, or collection pipeline immediately after installation. Before adopting it, confirm the composer.json PHP constraint accepts your project's PHP version and run composer why-not against your target application.
Does leovie/php-grouper work with Laravel collections?
The package is framework-agnostic, so it does not hook into Illuminate collections or the Laravel container. You can use it alongside Laravel collections, or you can use Collection::groupBy with a closure for many simple grouping cases. Evaluate whether the package's criteria API gives you enough additional value to justify the extra dependency.
What grouping criteria does leovie/php-grouper support?
The package is described as grouping by key name, closure, or callable, and it can apply one or more criteria. That lets you define grouping logic in code rather than scattering ad hoc array-building across your application. Check the README and source for the exact API signatures and supported criteria types before implementation.
Is leovie/php-grouper a good alternative to Laravel's groupBy?
Laravel's Illuminate\Support\Collection::groupBy already accepts a closure and returns keyed collections, and a closure returning a composite key covers most of this package's surface. leovie/php-grouper may help standardize grouping semantics when the same logic is reused across services or jobs, but it solves a small problem that is often hand-rolled in 30 to 80 lines. Prefer the built-in groupBy for simple cases and consider this package only when its criteria API clearly reduces duplication.
Does leovie/php-grouper support multi-level or nested grouping?
The available overview describes grouping by one or more criteria, but it does not confirm whether the package returns nested multi-level groups or a flat keyed structure. Verify the return shape in the README and source before using it for hierarchical reports. If you need guaranteed nested grouping, test a small fixture first or keep that logic in your application.
How does leovie/php-grouper handle null keys, missing properties, or mixed object types?
The available overview does not document how null keys, missing properties, mixed-type collections, or key coercion are handled. Those semantics matter because grouping libraries differ on silent buckets, exceptions, skipped items, and int-versus-string key collisions. Write tests with your real data shapes, including nulls and objects with missing properties, before relying on the package in production.
Which PHP and Laravel versions are compatible with leovie/php-grouper?
The last tagged release is from 2022-05-25, so it is a PHP 8.0 and 8.1-era codebase. Because the package is framework-agnostic, it has no Laravel version constraint, but you must verify its composer.json PHP constraint against Laravel 10 on PHP 8.1 and Laravel 11 or 12 on PHP 8.2 or newer. Also confirm it does not hard-pin PHP in a way that blocks PHP 8.3 or 8.4, and run the test suite on your exact PHP minor.
Is leovie/php-grouper actively maintained and safe for production?
It has very low adoption, a single maintainer, zero visible stars or dependents, and more than three years since the last release, so treat it as unmaintained source code rather than a supported library. Security risk is genuinely low because the package performs no I/O, deserialization, shelling out, or network access, and its BSD-3-Clause license is permissive and commercially safe. The main risks are abandonment, future PHP 8.3 or 8.4 deprecations, and undocumented grouping edge cases. If you adopt it, vendor or fork the code and define an explicit trigger for replacement.
How does leovie/php-grouper perform on large collections?
No benchmark or memory profile is published, so treat performance as unverified. A typical grouping implementation stores arrays of object references per group, so test with 10k and 100k objects and measure memory and runtime. If you group inside a hot loop or queue job, compare it against Collection::groupBy with a closure before committing to the dependency.
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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core