Collector is a plugin by Oliver Nybroe that adds support for using Laravel Collections inside of PhpStorm. This plugin includes handy refactorings for making your collections better and can convert normal PHP statements into collections.
The plugin features the following refactorings and based on your configuration will highlight code with recommendations to move to collections:
- foreach to collection
- array_map to collection
- map()->flatten() to flatMap
- Removing nested collections
- Closure to arrow functions
- where()->first() to firstWhere()
These features can help you more quickly refactor your PHP code to collections, and you can pick which refactorings you’d like the plugin to highlight based on individual project needs.
This plugin is available in the JetBrains marketplace: Collector – Plugins | JetBrains. You can also install Collector for PhpStorm in your editor by going to Preferences > Plugins > Marketplace and search for “Collector”