maslosoft/hedron PHP source code class header applier

Maslosoft Hedron

  1. Instalation
  2. Usage
  3. Configuration
  4. Template
  5. Replacing
  6. Resources

PHP source code class header applier

Latest Stable Version License

Quick Install
composer require maslosoft/hedron

Hedron helps you make your class headers up to date and consistent. It will apply predefined header to all files containing namespaced class definitions.


composer require maslosoft/hedron --dev


Preview list of files to apply headers

vendor/bin/hedron preview

Display rendered template

vendor/bin/hedron show

Apply header to all class files.

Backup/commit your project before continue. This will write headers to files.

vendor/bin/hedron commit


Configuration can be provided in yaml file .hedron.yml in root of your project. Hedron also uses composer.json to make your config easier, or even unnessesary.

Here is how config might look like with example values (see .hedron.example.yml):

# All paths are realtive to your project root
# Root path or paths with sources. If blank will use composer.autoload paths.
sources: ""
# Path to template file, if blank will use vendor/maslosoft/hedron/templates/default.html (no it's not html)
template: ""
# Filter configuration, by default empty. Below is some example filter.
			- app/*
			- app/cache/*
			- app/controllers/*
			- app/cache/CacheProvider.php
# Reserved 
# This contains composer.json as array
composer: ""
tmp: ""

All of this configuration is available in template.


Template uses handlebars as templating engine. It contains all data from .hedron.yml and composer.json.

Here is example, default template:

This software package is licensed under {{composer.license}} license.

@package {{}}
@licence {{composer.license}}
{{#each composer.authors}}
@copyright Copyright (c) {{name}} <{{email}}>
{{#if composer.homepage}}@link {{composer.homepage}}{{/if}}

And after rendering it looks like that:

 * This software package is licensed under New BSD license.
 * @package maslosoft/hedron
 * @licence New BSD
 * @copyright Copyright (c) Peter Maselkowski <>
 * @link


This script modifies source files en masse. For safety and robustness it uses native php tokenizer and replaces everything before namespace token. Only that. If there is no namespace declaration file will not be modified.


0 0
1 follower
5 647 downloads
Yii Version: Unknown
License: (not set)
Category: Others
Developed by: pmaselkowski
Created on: Jul 22, 2018
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions