{"id":30614597,"url":"https://github.com/jackd248/php-doc-block-header-fixer","last_synced_at":"2025-10-29T00:07:54.640Z","repository":{"id":308728761,"uuid":"1033812673","full_name":"jackd248/php-doc-block-header-fixer","owner":"jackd248","description":"📝 PHP CS Fixer rule for fix the class header regarding PHP DocBlocks","archived":false,"fork":false,"pushed_at":"2025-10-23T12:21:58.000Z","size":190,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-23T13:35:29.828Z","etag":null,"topics":["php-cs-fixer","php-cs-fixer-custom-fixers"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackd248.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-07T11:37:19.000Z","updated_at":"2025-10-23T12:22:00.000Z","dependencies_parsed_at":"2025-08-07T15:32:36.178Z","dependency_job_id":"f1935d76-6ff1-4995-8f07-5f1f5053f3aa","html_url":"https://github.com/jackd248/php-doc-block-header-fixer","commit_stats":null,"previous_names":["jackd248/php-doc-block-header-fixer"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jackd248/php-doc-block-header-fixer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Fphp-doc-block-header-fixer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Fphp-doc-block-header-fixer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Fphp-doc-block-header-fixer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Fphp-doc-block-header-fixer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackd248","download_url":"https://codeload.github.com/jackd248/php-doc-block-header-fixer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackd248%2Fphp-doc-block-header-fixer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281533473,"owners_count":26517832,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["php-cs-fixer","php-cs-fixer-custom-fixers"],"created_at":"2025-08-30T07:15:50.253Z","updated_at":"2025-10-29T00:07:54.635Z","avatar_url":"https://github.com/jackd248.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Php DocBlock Header Fixer\n\n[![Coverage](https://img.shields.io/coverallsCoverage/github/jackd248/php-doc-block-header-fixer?logo=coveralls)](https://coveralls.io/github/jackd248/php-doc-block-header-fixer)\n[![CGL](https://img.shields.io/github/actions/workflow/status/jackd248/php-doc-block-header-fixer/cgl.yml?label=cgl\u0026logo=github)](https://github.com/jackd248/php-doc-block-header-fixer/actions/workflows/cgl.yml)\n[![Tests](https://img.shields.io/github/actions/workflow/status/jackd248/php-doc-block-header-fixer/tests.yml?label=tests\u0026logo=github)](https://github.com/jackd248/php-doc-block-header-fixer/actions/workflows/tests.yml)\n[![Supported PHP Versions](https://img.shields.io/packagist/dependency-v/konradmichalik/php-doc-block-header-fixer/php?logo=php)](https://packagist.org/packages/konradmichalik/php-doc-block-header-fixer)\n\n\u003c/div\u003e\n\nThis packages contains a [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) rule to automatically fix the header regarding PHP DocBlocks for classes, interfaces, traits and enums.\n\n**Before:**\n\n```php\n\u003c?php\n\nclass MyClass\n{\n    public function myMethod()\n    {\n        // ...\n    }\n}\n\ninterface MyInterface {}\ntrait MyTrait {}\nenum MyEnum {}\n```\n\n**After:**\n\n```php\n\u003c?php\n/**\n * MyClass.\n *\n * @author Your Name \u003cyour@email.org\u003e\n * @license GPL-3.0-or-later\n */\nclass MyClass\n{\n    // ...\n}\n```\n\n## 🔥 Installation\n\n[![Packagist](https://img.shields.io/packagist/v/konradmichalik/php-doc-block-header-fixer?label=version\u0026logo=packagist)](https://packagist.org/packages/konradmichalik/php-doc-block-header-fixer)\n[![Packagist Downloads](https://img.shields.io/packagist/dt/konradmichalik/php-doc-block-header-fixer?color=brightgreen)](https://packagist.org/packages/konradmichalik/php-doc-block-header-fixer)\n\n\n```bash\ncomposer require --dev konradmichalik/php-doc-block-header-fixer\n```\n\n## ⚡ Usage\n\nAdd the PHP-CS-Fixer rule in your `.php-cs-fixer.php` file:\n\n\u003e [!NOTE]\n\u003e This fixer is compatible with standard PHP-CS-Fixer rules. It avoids adding annotations that conflict with rules like `phpdoc_no_package` and follows spacing conventions compatible with `phpdoc_separation`.\n\n```php\n\u003c?php\n// ...\nreturn (new PhpCsFixer\\Config())\n    // ...\n    -\u003eregisterCustomFixers([\n        new KonradMichalik\\PhpDocBlockHeaderFixer\\Rules\\DocBlockHeaderFixer()\n    ])\n    -\u003esetRules([\n        'KonradMichalik/docblock_header_comment' =\u003e [\n            'annotations' =\u003e [\n                'author' =\u003e 'Konrad Michalik \u003chej@konradmichalik.dev\u003e',\n                'license' =\u003e 'GPL-3.0-or-later',\n            ],\n            'preserve_existing' =\u003e true,\n            'separate' =\u003e 'none',\n            'add_structure_name' =\u003e true,\n        ],\n    ])\n;\n```\n\nAlternatively, you can use a object-oriented configuration:\n\n```php\n\u003c?php\n// ...\nreturn (new PhpCsFixer\\Config())\n    // ...\n    -\u003eregisterCustomFixers([\n        new KonradMichalik\\PhpDocBlockHeaderFixer\\Rules\\DocBlockHeaderFixer()\n    ])\n    -\u003esetRules([\n        KonradMichalik\\PhpDocBlockHeaderFixer\\Generators\\DocBlockHeader::create(\n            [\n                'author' =\u003e 'Konrad Michalik \u003chej@konradmichalik.dev\u003e',\n                'license' =\u003e 'GPL-3.0-or-later',\n            ],\n            preserveExisting: true,\n            separate: \\KonradMichalik\\PhpDocBlockHeaderFixer\\Enum\\Separate::None,\n            addStructureName: true\n        )-\u003e__toArray()\n    ])\n;\n```\n\nOr even simpler, automatically read all authors and license from your `composer.json`:\n\n```php\n\u003c?php\n// ...\nreturn (new PhpCsFixer\\Config())\n    // ...\n    -\u003eregisterCustomFixers([\n        new KonradMichalik\\PhpDocBlockHeaderFixer\\Rules\\DocBlockHeaderFixer()\n    ])\n    -\u003esetRules([\n        KonradMichalik\\PhpDocBlockHeaderFixer\\Generators\\DocBlockHeader::fromComposer()-\u003e__toArray()\n    ])\n;\n```\n\n## ⚙️ Configuration\n\n- `annotations` (array): DocBlock annotations to add to classes\n- `preserve_existing` (boolean, default: true): Keep existing DocBlock annotations\n- `separate` (string, default: 'none'): Add blank lines ('top', 'bottom', 'both', 'none')\n- `add_structure_name` (boolean, default: false): Add class name as first line in DocBlock\n- `ensure_spacing` (boolean, default: true): Ensure proper spacing after DocBlocks to prevent conflicts with PHP-CS-Fixer rules\n\n## 🧑‍💻 Contributing\n\nPlease have a look at [`CONTRIBUTING.md`](CONTRIBUTING.md).\n\n## ⭐ License\n\nThis project is licensed under [GNU General Public License 3.0 (or later)](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackd248%2Fphp-doc-block-header-fixer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackd248%2Fphp-doc-block-header-fixer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackd248%2Fphp-doc-block-header-fixer/lists"}