{"id":20021931,"url":"https://github.com/haehnchen/idea-php-annotation-plugin","last_synced_at":"2025-05-16T13:07:25.015Z","repository":{"id":10751343,"uuid":"13011199","full_name":"Haehnchen/idea-php-annotation-plugin","owner":"Haehnchen","description":"Add PHP annotation support for PhpStorm and IntelliJ","archived":false,"fork":false,"pushed_at":"2025-04-23T16:39:42.000Z","size":38736,"stargazers_count":255,"open_issues_count":24,"forks_count":43,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-23T17:44:19.379Z","etag":null,"topics":["annotation","doctrine","intellij","intellij-plugin","java","phpstorm","phpstorm-plugin","symfony"],"latest_commit_sha":null,"homepage":"https://plugins.jetbrains.com/plugin/7320","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Haehnchen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["Haehnchen"],"custom":"https://www.paypal.me/DanielEspendiller"}},"created_at":"2013-09-22T09:50:45.000Z","updated_at":"2025-04-23T16:39:46.000Z","dependencies_parsed_at":"2024-03-20T19:56:31.032Z","dependency_job_id":"7b84fa82-5f40-49a1-b20c-dd609fdd9cd6","html_url":"https://github.com/Haehnchen/idea-php-annotation-plugin","commit_stats":null,"previous_names":[],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haehnchen%2Fidea-php-annotation-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haehnchen%2Fidea-php-annotation-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haehnchen%2Fidea-php-annotation-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haehnchen%2Fidea-php-annotation-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Haehnchen","download_url":"https://codeload.github.com/Haehnchen/idea-php-annotation-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535829,"owners_count":22087399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotation","doctrine","intellij","intellij-plugin","java","phpstorm","phpstorm-plugin","symfony"],"created_at":"2024-11-13T08:38:40.840Z","updated_at":"2025-05-16T13:07:25.002Z","avatar_url":"https://github.com/Haehnchen.png","language":"Java","readme":"IntelliJ IDEA - PhpStorm PHP Annotations / Attributes\n==========================\n[![Build Status](https://github.com/Haehnchen/idea-php-annotation-plugin/actions/workflows/gradle.yml/badge.svg?branch=master)](https://github.com/Haehnchen/idea-php-annotation-plugin/actions/workflows/gradle.yml)\n[![Version](http://phpstorm.espend.de/badge/7320/version)](https://plugins.jetbrains.com/plugin/7320)\n[![Downloads](http://phpstorm.espend.de/badge/7320/downloads)](https://plugins.jetbrains.com/plugin/7320)\n[![Downloads last month](http://phpstorm.espend.de/badge/7320/last-month)](https://plugins.jetbrains.com/plugin/7320)\n[![Donate to this project using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/DanielEspendiller)\n\nProvides PHP annotation extended Attribute support and for PhpStorm / IntelliJ IDEA and references for \"Code \u003e Optimize Imports\" action.\n\n| Key        | Value                                     |\n|------------|-------------------------------------------|\n| Plugin url | https://plugins.jetbrains.com/plugin/7320 |\n| Id         | de.espend.idea.php.annotation             |\n| Changelog  | [CHANGELOG](CHANGELOG.md)                 |\n\n### Install\n* [Download plugin](https://plugins.jetbrains.com/plugin/7320) or install directly out of PhpStorm\n* Force file reindex if necessary with: `File -\u003e Invalidate Cache`\n\n### Settings\n\n`PHP \u003e Annotations / Attributes`\n\n#### Round brackets\n\n```php\n/**\n * @Foo\u003ccaret\u003e()\n * @Foo\u003ccaret\u003e\n */\nclass NotBlank extends Constraint {}\n```\n\n#### Use / Import alias\n\n`PHP -\u003e Annotations / Attributes -\u003e Use Alias`\n\n##### Annotations\n\n```php\n\nuse Doctrine\\ORM\\Mapping as ORM;\n\n/**\n * @Id() -\u003e @ORM\\Id()\n * @NotBlank() -\u003e @Assert\\NotBlank()\n */\nclass Foo {}\n```\n\n##### Attributes\n\n\n```php\n\nuse Doctrine\\ORM\\Mapping as ORM;\n\n#[Id] -\u003e #[ORM\\Id()]\n#[NotBlank] -\u003e #[Assert\\NotBlank()]\nclass Foo {}\n```\n\n#### Class LineMarker\n\nLineMarker which provides navigation to annotation class usages\n\n```php\nnamespace Doctrine\\ORM\\Mapping;\n\n/**\n * @Annotation\n */\nfinal class Entity implements Annotation\n{\n}\n```\n\nTargeting\n\n```php\n\n/**\n * @ORM\\Entity()\n */\n```\n\n### Annotation Class Detection\n\n* Every class with `@Annotation` inside class doc block is detected on file indexing\n* Annotation Properties on property names\n* Property value types\n* @ENUM Tags\n\n```php\n/**\n * @Annotation\n */\nclass NotBlank extends Constraint {\n    public $message = 'This value should not be blank.';\n    public $groups = array();\n\n    /**\n     * @var bool|boolean\n     */\n    public $option = false;\n\n    /**\n     *\n     * @Enum({\"AUTO\", \"SEQUENCE\", \"TABLE\", \"IDENTITY\", \"NONE\", \"UUID\", \"CUSTOM\"})\n     */\n    public $strategy = 'AUTO';\n\n    /**\n     * @var array\u003cstring\u003e\n     */\n    public $cascade;\n    \n    /**\n     * @var mixed|foobar|bool\n     */\n    public $mixed;\n}\n```\n\nhttps://www.doctrine-project.org/projects/doctrine-annotations/en/latest/custom.html#attribute-types\n\n```php\n/**\n * @Annotation\n *\n * @Attributes({\n *   @Attribute(\"stringProperty\", type = \"string\"),\n *   @Attribute(\"annotProperty\",  type = \"bool\"),\n * })\n */\n *\n * @Attributes(\n *   @Attribute(\"stringProperty\", type = \"string\"),\n *   @Attribute(\"annotProperty\",  type = \"bool\"),\n * )\n */\nclass Foobar {}\n```\n\n### Annotation Target Detection\n\n`@Target` is used to attach annotation, if none provided it is added to \"ALL list\"\n\n```php\n/**\n * @Annotation\n * @Target(\"PROPERTY\", \"METHOD\", \"CLASS\", \"ALL\")\n */\nclass NotBlank extends Constraint {\n    public $message = 'This value should not be blank.';\n}\n```\n\n### Extension Points\n\nPlugins provides several extension points, which allows external plugins to provide additional. See some examples on [Symfony2 Plugin](https://github.com/Haehnchen/idea-php-symfony2-plugin/blob/master/META-INF/plugin.xml)\n\nExample for extension points.\n\n```xml\n\u003cextensionPoints\u003e\n      \u003cextensionPoint name=\"PhpAnnotationCompletionProvider\" interface=\"de.espend.idea.php.annotation.extension.PhpAnnotationCompletionProvider\"/\u003e\n      \u003cextensionPoint name=\"PhpAnnotationReferenceProvider\" interface=\"de.espend.idea.php.annotation.extension.PhpAnnotationReferenceProvider\"/\u003e\n      \u003cextensionPoint name=\"PhpAnnotationDocTagGotoHandler\" interface=\"de.espend.idea.php.annotation.extension.PhpAnnotationDocTagGotoHandler\"/\u003e\n      \u003cextensionPoint name=\"PhpAnnotationDocTagAnnotator\" interface=\"de.espend.idea.php.annotation.extension.PhpAnnotationDocTagAnnotator\"/\u003e\n      \u003cextensionPoint name=\"PhpAnnotationGlobalNamespacesLoader\" interface=\"de.espend.idea.php.annotation.extension.PhpAnnotationGlobalNamespacesLoader\"/\u003e\n      \u003cextensionPoint name=\"PhpAnnotationVirtualProperties\" interface=\"de.espend.idea.php.annotation.extension.PhpAnnotationVirtualProperties\"/\u003e\n      \n      \u003c!-- Custom class alias mapping: \"ORM\" =\u003e \"Doctrine\\\\ORM\\\\Mapping\" --\u003e\n      \u003cextensionPoint name=\"PhpAnnotationUseAlias\" interface=\"de.espend.idea.php.annotation.extension.PhpAnnotationUseAlias\"/\u003e\n\u003c/extensionPoints\u003e\n```\n\nUsage\n\n```xml\n\u003cextensions defaultExtensionNs=\"de.espend.idea.php.annotation\"\u003e\n  \u003cPhpAnnotationExtension implementation=\"de.espend.idea.php.annotation.completion.PhpAnnotationTypeCompletionProvider\"/\u003e\n\u003c/extensions\u003e\n```\n\n### PHP Attributes Bridge\n\nAll extensions points providing support to DocBlock and PHP Attributes at the same time.   \n\n```php\nuse Symfony\\Component\\Validator\\Constraints\\NotBlank;\n\n#[NotBlank(message: 'An empty file is not allowed.')]\n/* @NotBlank({message: \"An empty file is not allowed.\"}) */\n```\n\n```php\n#[Template('foo.html.twig')]\n/* @Template(\"foo.html.twig\") */\n```\n\n### Completion confidence\n\nAnnoying pressing completion shortcut? Plugin provides a nice completion confidence to open completion popover on several conditions\n\n```php\n/**\n * @\u003ccaret\u003e\n * \u003ccaret\u003e\n */\n```\n\n### Static values\n```php\n    /**\n     * @DI\\Observe(SomethingEvents::PRE_UPDATE)\n     */\n```\n\n### Doctrine\n\n#### ORM: Property generator\n\n```php\nclass Foo {\n    /**\n     * @ORM\\Id\n     * @ORM\\GeneratedValue(strategy=\"AUTO\")\n     * @ORM\\Column(type=\"integer\")\n     */\n    public $id\u003ccaret\u003e;\n}\n```\n\n```php\nclass Foo {\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue(strategy: 'AUTO')]\n    #[ORM\\Column(type: 'integer')]\n    public $id\u003ccaret\u003e;\n}\n```\n\n#### ORM: class entity generator\n\n```php\n#[ORM\\Entity(repositoryClass: \\Foo::class)]\n#[ORM\\Table(name: 'bike')]\nclass Foo { }\n```\n\n#### ORM: repository class generator / intention\n\n```php\n/**\n * @ORM\\Entity(repositoryClass=\"UnknownClass\")\n */\nclass Foo { }\n```\n\n```php\n/**\n * @ORM\\Entity\u003ccaret\u003e\n */\nclass Foo { }\n```\n\n#### ORM: repository class completion\n\n```php\n/**\n * @ORM\\Entity(repositoryClass=\"\u003ccaret\u003e\")\n */\n```\n\n### PHP Toolbox\n\nProvides integration for [PHP Toolbox](https://github.com/Haehnchen/idea-php-toolbox)\n\n#### Default and property values\n\n```php\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n\n/**\n * @Route(\"\u003ccaret\u003e\")\n * @Route(condition=\"\u003ccaret\u003e\")\n */\n```\n\n```javascript\n{\n  \"registrar\":[\n    {\n      \"signatures\":[\n        {\n          \"class\": \"Symfony\\\\Component\\\\Routing\\\\Annotation\\\\Route\",\n          \"type\": \"annotation\"\n        },\n        {\n          \"class\": \"Symfony\\\\Component\\\\Routing\\\\Annotation\\\\Route\",\n          \"field\": \"condition\",\n          \"type\": \"annotation\"\n        }\n      ],\n      \"provider\":\"foo\",\n      \"language\":\"php\"\n    }\n  ],\n}\n```\n\n#### Property array values\n\n```php\nuse Symfony\\Component\\Routing\\Annotation\\Route;\n\n/**\n * @Route(methods={\"\u003ccaret\u003e\"})\n */\n```\n\n```\n{\n  \"registrar\":[\n    {\n      \"language\":\"php\",\n      \"provider\":\"methods\",\n      \"signatures\":[\n        {\n          \"class\": \"Symfony\\\\Component\\\\Routing\\\\Annotation\\\\Route\",\n          \"type\": \"annotation_array\",\n          \"field\": \"methods\"\n        }\n      ]\n    }\n  ],\n  \"providers\": [\n    {\n      \"name\": \"methods\",\n      \"items\":[\n        {\n          \"lookup_string\": \"POST\"\n        }\n      ]\n    }\n  ]\n}\n```","funding_links":["https://github.com/sponsors/Haehnchen","https://www.paypal.me/DanielEspendiller"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaehnchen%2Fidea-php-annotation-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaehnchen%2Fidea-php-annotation-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaehnchen%2Fidea-php-annotation-plugin/lists"}