https://github.com/malukenho/docheader
A small tool to check license headers
https://github.com/malukenho/docheader
checker docheader php placeholder
Last synced: 6 months ago
JSON representation
A small tool to check license headers
- Host: GitHub
- URL: https://github.com/malukenho/docheader
- Owner: malukenho
- License: mit
- Created: 2016-05-23T21:55:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-02-05T12:07:56.000Z (over 1 year ago)
- Last Synced: 2025-03-31T14:11:58.140Z (6 months ago)
- Topics: checker, docheader, php, placeholder
- Language: PHP
- Homepage: https://github.com/malukenho/docheader
- Size: 197 KB
- Stars: 66
- Watchers: 3
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DocHeader
[](https://travis-ci.org/malukenho/docheader)
[](https://scrutinizer-ci.com/g/malukenho/docheader/?branch=master)
[](https://scrutinizer-ci.com/g/malukenho/docheader/?branch=master)
[](https://packagist.org/packages/malukenho/docheader)
[](https://packagist.org/packages/malukenho/docheader)
[](https://packagist.org/packages/malukenho/docheader)
[](https://packagist.org/packages/malukenho/docheader)How much time we have wasted to change copyright years in our project?
How much times we forget to update it and then we're in the middle of
a new year using last year copyright dated? *That's sucks!!one!!***Put doc header check in your build and get it out of your way!**
### Installing
```sh
composer require --dev --sort-packages malukenho/docheader
```### Setting up
Put your header in one `.docheader` file in the directory that you're
running the checker/fixer. It file must contain only the dockblock as
you want, like following example:```php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
```and then run the checker:
```sh
./vendor/bin/docheader check src/
```So, you get errors or a message saying that everything is ok!
### Docheader file
By default, the `docheader` search for a `.docheader` file on the current directory that
the command is executed. But you can specify a folder or a file to be used as placeholder
using the option `--docheader [file-or-path]`### Current year placeholder
You can also put `%year%` on your `.docheader` file to refer to the current
Year, like that:```php
/**
* @copyright Copyright (c) 2005-%year% Zend Technologies USA Inc. (http://www.zend.com)
*/
```### Regexp assertion
If you're using `>=0.1.5` version, you can use the `%regexp:%` placeholder to match some content.
Example:
```php
/**
* @copyright Copyright (c) 20%regexp:\d{2}%-2016 Zend Technologies USA Inc. (http://www.zend.com)
*/
```In this case `%regexp:\d{2}%` assert that it should be a number of two digits between `20` and `-`.