Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Docheader Laravel Package

malukenho/docheader

Laravel package that adds and manages standardized documentation headers in your source files. Generate consistent file/class docblocks with project metadata, author, license, and timestamps, helping teams enforce style and keep headers up to date automatically.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install via Composer: composer require --dev malukenho/docheader
  2. Run php artisan vendor:publish --provider="Malukenho\DocHeader\DocHeaderServiceProvider" to publish the config (config/docheader.php) and stubs
  3. Review and customize config/docheader.php β€” adjust templates for license, author, year, file type, etc.
  4. First use: php artisan docheader:generate to scan app/ and add headers to PHP files missing them

πŸ’‘ Ideal for onboarding new projects or cleaning up legacy codebases β€” start with a dry run: php artisan docheader:generate --dry-run

Implementation Patterns

  • CI Enforcement: Add php artisan docheader:check to your pipeline (e.g., GitHub Actions, GitLab CI) to fail if any file lacks a compliant header
  • Pre-commit Hook: Use husky + lint-staged or simple Git hooks to auto-fix headers on staged PHP files:
    php artisan docheader:apply --only-staged
    
  • Per-File Customization: Use @docblock-header ignore in a file’s docblock to exclude it from updates
  • Template Inheritance: Define base templates (e.g., company-header) and override per directory via config or --config flag for multirepo setups
  • Laravel Model/Controller Scoping: Run scoped commands like php artisan docheader:generate --path=app/Models to avoid touching tests or config

Gotchas and Tips

  • ⚠️ Date Handling: Year auto-detects current year by default β€” override via config ('year' => 2025) or flag (--year=2024) to avoid unnecessary diffs
  • ⚠️ Existing Headers: generate skips files with any valid header; update forces rewrite β€” use --force with care in shared repos
  • πŸ§ͺ Testing Tip: Add --filter=.*Test\.php$ to skip test headers during bulk ops; configure skip_patterns in config/docheader.php
  • πŸ”§ Extensibility: Extend \Malukenho\DocHeader\HeaderGenerator to inject custom tokens (e.g., {gitBranch} or {composerVersion})
  • πŸ“¦ Stale Package Warning: Last release in 2017 β€” verify compatibility with PHP 8.0+ via composer update --with-all-dependencies; check config/docheader.php uses phpstan-style docblocks (/** not /*!)
  • 🧩 Laravel-specific Tip: In config/docheader.php, add 'laravel' => true to auto-include @license MIT and @link https://laravel.com/docs/{version} via dynamic tokens
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation
uri-template/tests