Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/olivernybroe/collector-intellij

A PhpStorm plugin for refactoring to collections
https://github.com/olivernybroe/collector-intellij

hacktoberfest intellij intellij-plugin laravel laravel-collections phpstorm phpstorm-plugin

Last synced: 12 days ago
JSON representation

A PhpStorm plugin for refactoring to collections

Awesome Lists containing this project

README

        


collector header


GitHub Workflow Status (master)
Total Downloads
Latest Version

# Collector - A collection's plugin for PhpStorm

This plugin adds support for Laravel Collections.

It contains a bunch of handy refactorings for making your collections better.
It can also convert normal PHP statements into collections.

## Installation
The plugin has no stable version, only manual and EAP is possible.

- Using IDE built-in plugin system:

Preferences > Plugins > Marketplace > Search for "Collector" >
Install Plugin

- Manually:

Download the [latest release](https://github.com/olivernybroe/collections-intellij/releases/latest) and install it manually using
Preferences > Plugins > ⚙️ > Install plugin from disk...

## Configuration
> :warning: The inspections might be disabled by default! Go to preferences for enabling them.

All the features are added as inspections in PhpStorm, this means you can disable
the ones you don't like or change how severe the warning are on them.

For example, by default refactoring `foreach` to collection is not highlighting the text.
However, if you would like to enforce yourself to never use `foreach`, you can change the severity to error.

![inspection-settings](https://github.com/olivernybroe/collector-intellij/blob/main/art/usage/inspection.jpg?raw=1)

## Features

### `foreach` to collection
![foreach-example](https://github.com/olivernybroe/collector-intellij/blob/main/art/usage/foreach.gif?raw=1)

### `array_map` to collection
![array_map-example](https://github.com/olivernybroe/collector-intellij/blob/main/art/usage/array_map.gif?raw=1)

### `map(...)->flatten(1)` to `flatMap`
![flatmap-example](https://github.com/olivernybroe/collector-intellij/blob/main/art/usage/flatmap.gif?raw=1)

### Remove nested collections
![recursive-collection-example](https://github.com/olivernybroe/collector-intellij/blob/main/art/usage/recursiveCollection.gif?raw=1)

### Closure to arrow functions
![closure-to-arrow-example](https://github.com/olivernybroe/collector-intellij/blob/main/art/usage/closureToArrow.gif?raw=1)

### `where(...)->first()` to `firstWhere`
![where-first-to-firstWhere-example](https://github.com/olivernybroe/collector-intellij/blob/main/art/usage/where-first-to-firstWhere.gif?raw=1)

### `where(...)->isNotEmpty()` to `contains`
![where-isNotEmpty-to-contains-example](https://github.com/olivernybroe/collector-intellij/blob/main/art/usage/whereIsNotEmpty-to-contains.gif?raw=1)

## Credits

- [Oliver Nybroe](https://github.com/olivernybroe)
- [All contributors](https://github.com/olivernybroe/collector-intellij/contributors)

Special thanks to [Caneco](https://twitter.com/caneco) for the logo ✨

---
Plugin based on the [IntelliJ Platform Plugin Template][template].

[template]: https://github.com/JetBrains/intellij-platform-plugin-template