Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Haehnchen/idea-php-toolbox
Collections of tools and improvements to make PhpStorm a little bit better
https://github.com/Haehnchen/idea-php-toolbox
annotation intellij intellij-plugin java php phpstorm phpstorm-plugin twig
Last synced: 5 days ago
JSON representation
Collections of tools and improvements to make PhpStorm a little bit better
- Host: GitHub
- URL: https://github.com/Haehnchen/idea-php-toolbox
- Owner: Haehnchen
- License: mit
- Created: 2014-12-28T13:37:25.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-03-29T15:40:06.000Z (over 1 year ago)
- Last Synced: 2024-07-31T12:07:39.521Z (3 months ago)
- Topics: annotation, intellij, intellij-plugin, java, php, phpstorm, phpstorm-plugin, twig
- Language: Java
- Homepage: http://phpstorm.espend.de/php-toolbox
- Size: 521 KB
- Stars: 159
- Watchers: 14
- Forks: 20
- Open Issues: 55
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- favorite-link - 收集工具和改进使 PhpStorm 更好一点。
- awesome-shopware - PHP Toolbox - PHP Toolbox includes some Shopware configurations. (IDE / PhpStorm Plugins)
README
Intellij / PhpStorm Plugin for PHP Improvements
========================[![Build Status](https://github.com/Haehnchen/idea-php-toolbox/actions/workflows/gradle.yml/badge.svg?branch=master)](https://github.com/Haehnchen/idea-php-toolbox/actions/workflows/gradle.yml)
[![Version](http://phpstorm.espend.de/badge/8133/version)](https://plugins.jetbrains.com/plugin/8133)
[![Downloads](http://phpstorm.espend.de/badge/8133/downloads)](https://plugins.jetbrains.com/plugin/8133)
[![Downloads last month](http://phpstorm.espend.de/badge/8133/last-month)](https://plugins.jetbrains.com/plugin/8133)
[![Donate to this project using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/DanielEspendiller)Key | Value
----------- | -----------
Plugin Url | http://plugins.jetbrains.com/plugin?pr=&pluginId=8133
ID | de.espend.idea.php.toolbox
Doc x | http://phpstorm.espend.de/php-toolbox## Screenshots
![Php Toolbox PHPUnit](https://plugins.jetbrains.com/files/8133/screenshot_15579.png)## Core improvements
### Type hint variable
```php
// Strips several non common variable names of type hint completion; like "interface"
function foo(FooInterface $)
function foo(FooAbstract $)
function foo(FooExtension $)
```### Callable arrays
```php
class Bar
{
public function foo()
{
[$this, 'foo']
[$foo, 'foo']
}
}
$foo = new Bar();
```### String class, method and function navigation
```php
foo('\\DateTime');
foo('\\DateTime:format');
foo('\\DateTime::format');
'DateTime::format';
'date';
```## Json Configuration
All files in project named `.ide-toolbox.metadata.json` or application folder with pattern `/php-toolbox/*-toolbox.metadata.json`. Find your application "Settings > Languages & Framework > PHP Toolbox"
```json
{
"registrar":[
{
"signature":[
"Behat\\Behat\\Context\\Environment\\ContextEnvironment:hasContextClass",
"Behat\\Behat\\Context\\Environment\\InitializedContextEnvironment:getContext"
],
"provider":"behat_context_classes",
"language":"php"
}
],
"providers": [
{
"name": "behat_context_classes",
"source": {
"contributor": "sub_classes",
"parameter": "Behat\\Behat\\Context\\Context"
}
}
]
}
```### Registrar
```json
{
"provider":"date_format",
"language":"php",
"signatures":[
{
"class": "DateTime",
"method": "format"
},
{
"class": "PHPUnit_Framework_TestCase",
"method": "getMock",
"type": "type"
},
{
"class": "Symfony\\Component\\HttpFoundation\\Response",
"method": "__construct",
"type": "array_key",
"index": 2
},
{
"class": "Symfony\\Component\\HttpFoundation\\Response",
"method": "__construct",
"index": 2,
"array": "Content-Type"
}
]
}
```#### Function
```php
foo('')
``````json
{
"function": "foo"
}
``````php
foo('', '')
``````json
{
"function": "foo",
"index": 1
}
```#### Class method
```php
/** @var $f \\FooClass */
$f->foo('')
``````json
{
"class": "FooClass",
"method": "foo"
}
``````php
/** @var $f \\FooClass */
$f->foo('', '')
``````json
{
"class": "FooClass",
"method": "foo",
"index": 1
}
```#### Types
```php
/** @var $f \\FooClass */
$f->foo('date_time')->format
$f->foo(DateTime::class)->format
$f->foo(new DateTime())->format
$f->bar('', 'date_time')->format
``````json
{
"registrar":[
{
"provider":"date",
"language":"php",
"signatures":[
{
"class": "FooClass",
"method": "foo",
"type": "type"
},
{
"class": "FooClass",
"method": "bar",
"index": 1,
"type": "type"
}
]
}
],
"providers": [
{
"name": "date",
"items":[
{
"lookup_string": "date_time",
"type": "DateTime"
}
]
}
]
}
```#### Inline Code
```php
(new \Foo\Car())->foo('');
foo('');
``````php
Class Car
{
/**
* @param string $foo my Var #Class
* @param string $bar my car # foo bar
*/
public function foo($foo, $bar) {}
}/**
* @param string $foo my Var #Class
*/
function foo($foo) {}
```#### Array
```php
foo([''])
``````json
{
"function": "foo",
"type": "array_key"
}
``````php
foo(['foo' => ''])
``````json
{
"function": "foo",
"array": "foo"
}
```#### Signature shortcut
```json
{
"provider":"class_interface",
"language":"php",
"signature":[
"ReflectionProperty:__construct",
"class_exists",
"is_subclass_of:1" // ":1" means 2nd argument (arguments indexing starts from 0)
]
}
```#### Twig
```twig
{{ foo('') }}
{% if foo('') %}
{% set bar = foo('') %}
{{ 'bar'|foo('') }}
``````json
{
"provider":"date_format",
"language":"twig",
"signatures":[
{
"function": "foo"
}
]
}
```### Providers
```json
{
"name": "date_format",
"items":[
{
"lookup_string": "d",
"type_text": "Day of month (01..31)",
"icon": "com.jetbrains.php.PhpIcons.METHOD",
"presentable_text": "foo",
"tail_text": "foo",
"type": "DateTime",
"target": "DateTime",
"target": "Ns\\Time::format",
"target": "DateTime:format",
"target": "file://foo/foo.html.twig",
}
]
}
```#### Lookup shortcut
```json
{
"name": "date_format",
"lookup_strings": ["car", "apple"]
}
```#### Lookup defaults
```json
{
"name": "date_format",
"defaults": {
"icon":"com.jetbrains.php.PhpIcons.METHOD",
},
"items": [
{
"lookup_string":"d",
}
]
}
```#### Sources
##### return```php
class SecurityExtension implements Twig_ExtensionInterface
{
public function getName()
{
return 'security'
}
}
class WebProfilerExtension extends Twig_ExtensionInterface
{
public function getName()
{
return 'profiler'
}
}
``````json
{
"name": "twig_extensions",
"source": {
"contributor": "return",
"parameter": "Twig_ExtensionInterface::getName"
}
}
```##### return_array
```php
class UserAdmin implements AdminInterface
{
public function getExportFormats()
{
return ['json', 'xml']
}
}
class TopicAdmin extends AdminInterface
{
public function getExportFormats()
{
return ['csv', 'xls']
}
}
``````json
{
"name": "sonata_admin_export_formats",
"source": {
"contributor": "return_array",
"parameter": "Sonata\\AdminBundle\\Admin\\AdminInterface:getExportFormats"
}
}
```##### sub_classes
```php
class Foo implements BehatContext {}
class Foo extends BehatContext {}
``````json
{
"name": "behat_context_classes",
"source": {
"contributor": "sub_classes",
"parameter": "BehatContext"
}
}
```###### traits
```json
{
"provider": "trait",
"language": "php"
}
```