chrgriffin / collection-macro-thanos
Laravel Collection macro: randomly delete half of the items in a Collection.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/chrgriffin/collection-macro-thanos
Requires
- php: ^7.1.3
Requires (Dev)
- orchestra/testbench: ^4.0
- php-coveralls/php-coveralls: ^2.2
This package is auto-updated.
Last update: 2025-09-29 02:30:10 UTC
README
Laravel Collection Macro: Thanos
This macro for Laravel Collections will randomly delete half the items in a collection.
Installation
Install in your Laravel project via composer:
composer install chrgriffin/collection-macro-thanos
If your version of Laravel supports auto-discovery (versions 5.5 and up), that's it!
For older versions of Laravel, you will need to edit your config/app.php
file to include the service provider in your providers array:
return [ // ... 'providers' => [ // ... CollectionMacroThanos\ServiceProvider::class ] ];
Usage
You should now be able to chain ->thanos()
onto any collections to randomly delete half the items in the collection.
$collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) ->thanos(); // 1, 3, 4, 6, 8