https://github.com/nunomaduro/laravel-any
🏓 Laravel collection macro that determine if `any` item from the collection passes the given truth test.
https://github.com/nunomaduro/laravel-any
any collection helper laravel macro package
Last synced: about 2 months ago
JSON representation
🏓 Laravel collection macro that determine if `any` item from the collection passes the given truth test.
- Host: GitHub
- URL: https://github.com/nunomaduro/laravel-any
- Owner: nunomaduro
- License: mit
- Created: 2020-02-06T15:17:54.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-07T09:48:09.000Z (about 5 years ago)
- Last Synced: 2025-02-24T13:36:30.186Z (about 2 months ago)
- Topics: any, collection, helper, laravel, macro, package
- Language: PHP
- Homepage: https://nunomaduro.com
- Size: 424 KB
- Stars: 37
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
![]()
## About laravel-any
laravel-any was created by, and is maintained by [Nuno Maduro](https://github.com/nunomaduro), and is an Laravel collection macro that determine if any item from the collection passes the given truth test.
## Installation & Usage
> **Requires [PHP 7.2+](https://php.net/releases/)**
Create your package using [Composer](https://getcomposer.org):
```bash
composer require nunomaduro/laravel-any
```How to use:
```php
$users = User::all();// Returns `true` if the collection is not empty.
$users->any();// Returns `true` if there is a user with a paid plan.
$users->any(fn ($user) => $user->has_paid_plan);// Returns `true` if there is a user with a paid plan.
$users->any->has_paid_plan;
```## Contributing
Thank you for considering to contribute to laravel-any. All the contribution guidelines are mentioned [here](CONTRIBUTING.md).
You can have a look at the [CHANGELOG](CHANGELOG.md) for constant updates & detailed information about the changes. You can also follow the twitter account for latest announcements or just come say hi!: [@enunomaduro](https://twitter.com/enunomaduro)
## Support the development
**Do you like this project? Support it by donating**- PayPal: [Donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L)
- Patreon: [Donate](https://www.patreon.com/nunomaduro)## License
laravel-any is an open-sourced software licensed under the [MIT license](LICENSE.md).