PHPackages                             jameshalsall/licenser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jameshalsall/licenser

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jameshalsall/licenser
=====================

Adds license headers to your source files

0.5.0(10y ago)143.3k2[1 issues](https://github.com/jameshalsall/licenser/issues)3MITPHP

Since Feb 15Pushed 10y ago3 watchersCompare

[ Source](https://github.com/jameshalsall/licenser)[ Packagist](https://packagist.org/packages/jameshalsall/licenser)[ RSS](/packages/jameshalsall-licenser/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (5)Versions (8)Used By (3)

PHP Licenser
============

[](#php-licenser)

Automates the prepending of a license header doc block to your directory(ies) of source files.

Currently still in development, but will:

- Accept a directory of source files or a path to a single source file to process
- Accept a file path containing your custom license doc block
- Will not add license headers to files that have comments before the class declaration (class doc blocks are okay) unless you explicitly tell it to
- Can check your source files for the correct license information

Usage
-----

[](#usage)

1. Add `"jameshalsall/licenser":"dev-master"` to your `composer.json` `require-dev`
2. Run `composer update`
3. Run `./bin/licenser run /path/to/source/files /path/to/license/file` to process source files

Using a built-in license type
-----------------------------

[](#using-a-built-in-license-type)

Licenser supports the following built-in licenses:

- The Apache 2.0 license (referred to as `apache-2.0` in Licenser)
- The MIT license (referred to as `mit` in Licenser)

To use one of these built-in licenses you just replace the path to your custom licenses file with the name of the built-in license instead. For example if you wanted to use the MIT license then you would run something like:

```
./bin/licenser run /path/to/files mit --owners="steve@apple.com tim@apple.com"

```

### Value replacement in built-in licenses

[](#value-replacement-in-built-in-licenses)

When using a built-in license the Licenser will replace special placeholders with custom values. The following twig placeholder values are used:

- `thisYear` (always replaced with the current year)
- `owner` (replaced with the value you specify via the `--owners` option, or ignored if you don't specify a value)

Replacing an existing license
-----------------------------

[](#replacing-an-existing-license)

You can tell the Licenser to replace an existing license header with a new one by using the `--replace-existing` option when running the command. This will tell Licenser to remove any existing licenses and replace them with the new one generated.

Checking files for correct license
----------------------------------

[](#checking-files-for-correct-license)

Licenser also allows you to check your source files for correct license information. It will warn you if there are any source files that do not have a license header that matches the options you provide.

```
./bin/licenser check /path/to/files mit --owners=steve@apple.com

```

### Caution

[](#caution)

It is recommended that you have your source files under version control when running the tool as it is still experimental and very much in development.

Roadmap
-------

[](#roadmap)

- Add support for replacing an existing license (thanks to @markwilson)
- Add built-in license options
- Add dry-run option to see affected files before adding headers (thanks to @unfunco)
- Add support for processing single files (thanks to @jeroensmit)
- Add support for placeholders in custom license files (such as year, owner etc.)

Bug Reporting
-------------

[](#bug-reporting)

If you find any problems with the library then open an issue with a description of the problem and I will aim to resolve it.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~136 days

Recently: every ~83 days

Total

7

Last Release

3744d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/463807?v=4)[jaitsu](/maintainers/jaitsu)[@Jaitsu](https://github.com/Jaitsu)

---

Top Contributors

[![jameshalsall](https://avatars.githubusercontent.com/u/499932?v=4)](https://github.com/jameshalsall "jameshalsall (37 commits)")[![markwilson](https://avatars.githubusercontent.com/u/81990?v=4)](https://github.com/markwilson "markwilson (6 commits)")[![unfunco](https://avatars.githubusercontent.com/u/1716636?v=4)](https://github.com/unfunco "unfunco (2 commits)")[![mathewpeterson](https://avatars.githubusercontent.com/u/203190?v=4)](https://github.com/mathewpeterson "mathewpeterson (1 commits)")

---

Tags

licenselicense-managementlicensesphpplaceholder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jameshalsall-licenser/health.svg)

```
[![Health](https://phpackages.com/badges/jameshalsall-licenser/health.svg)](https://phpackages.com/packages/jameshalsall-licenser)
```

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19467.3M1.9k](/packages/drupal-core)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103574.3k68](/packages/friendsoftypo3-content-blocks)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6943.5M448](/packages/drupal-core-recommended)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M668](/packages/shopware-core)[chameleon-system/chameleon-base

The Chameleon System core.

1029.4k6](/packages/chameleon-system-chameleon-base)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
