PHPackages                             burntromi/exception-generator - 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. burntromi/exception-generator

ActiveApplication

burntromi/exception-generator
=============================

Tool for creating standard exceptions

1.0.1(9y ago)3181MITPHPPHP ^5.6 || ^7.0

Since Nov 22Pushed 9y ago2 watchersCompare

[ Source](https://github.com/burntromi/exception-generator)[ Packagist](https://packagist.org/packages/burntromi/exception-generator)[ RSS](/packages/burntromi-exception-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (2)Used By (0)

Burntromi Exception-Generator
=============================

[](#burntromi-exception-generator)

In software projects and libraries it is very common and needed to generate exception classes. For generating these classes, the following best-practice enforced in the PHP environment:

The manual creation of those classes is time-consuming and error-prone. To save time and reduce errors, this tool was made!

[![Build Status](https://camo.githubusercontent.com/0065c7b836bf5cd8db75e5545a1d9dc0173a359d91f7f7b44132517844cdce79/68747470733a2f2f7472617669732d63692e6f72672f6275726e74726f6d692f657863657074696f6e2d67656e657261746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/burntromi/exception-generator)[![Latest Stable Version](https://camo.githubusercontent.com/be0ffd9374ebc2a30402d2c66632c9a48e219597ae7424727c09c2e8cd7d098c/68747470733a2f2f706f7365722e707567782e6f72672f6275726e74726f6d692f657863657074696f6e2d67656e657261746f722f76657273696f6e)](https://packagist.org/packages/burntromi/exception-generator)[![License](https://camo.githubusercontent.com/13459f2882d35238cbfa1b0e837a545d653323d205a1440e2196af2e3eb7a82e/68747470733a2f2f706f7365722e707567782e6f72672f6275726e74726f6d692f657863657074696f6e2d67656e657261746f722f6c6963656e7365)](https://packagist.org/packages/burntromi/exception-generator)

Installation/Usage
------------------

[](#installationusage)

```
composer global require burntromi/exception-generator

```

Make sure you have `~/.composer/vendor/bin/` in your path.

```
exception-generator [PATH]

```

Where `PATH` is your source code path where the exception classes should be generated.

Possible Options
----------------

[](#possible-options)

`--overwrite (-o)`:

Give permissions to overwrite all existing files, without asking for each file to be overwritten.

`--template-path=PATH (-t PATH)`:

Can be usesd to determine the PATH you want the application to look for templates for creating the exception classes/interface. If a template cannot be found in this PATH, the application will search for other ways to find a template to use. At first it will check the config file (.exception-generator.json), which is located in `$HOME`. If this also fails, it will use given templates from the tool itself.

`--no-parents (-p)`:

Disables feature for searching and using parent exception classes.

`--help (-h)`:

Display help text and exit.

How is the namespace determined?
--------------------------------

[](#how-is-the-namespace-determined)

The tool starts from the current dir. If there can be a PHP file found, it trys to resolve a namespace out of this file. Otherwise, it iterates, starting from the current dir, up through all folders until a PHP file is found and a namespace can be resolved. After this, the iterated paths will be added to the resolved namespace.

If the application finds a composer.json, while iterating through, it attempts to determine the namespace out of it by using the entry "autoload" (psr-4 und psr-0), where psr-4 has a higher priority than psr-0.

If the application encounters a .git folder, while iterating through and also neither a PHP file, nor a composer.json are found in this directory and therfore no namespace can be determined, the iteration will be aborted and you are forced to input the namespace manually.

If you are not using the "p" paramter, the application will also check for parent exceptions, which will be used as base exceptions for inheritance when found.

The determined namespace will be shown after all and you are asked to verify it with "enter" or to correct it.

The config file (.exception-generator.json)
-------------------------------------------

[](#the-config-file-exception-generatorjson)

This should be located in `$HOME` and use the following pattern:

```
{
    "templatepath": {
        "global": "/home/user/exception-generator/global",
        "projects": {
            "/data/projects/myproject": "/home/user/exception-generator/myproject/"
        }
    }
}
```

At first it will try to match a path from "projects" with the current dir you are in and will use the most likely path, which contains a template, if there are more than one match. If this fails, it will check the entry in "global" for a template. Otherwise the tool will use given templates from itself.

Tests
-----

[](#tests)

run PHPUnit:

```
./vendor/bin/phpunit

```

run Behat:

```
./vendor/bin/behat

```

License
-------

[](#license)

MIT see [LICENSE.md](LICENSE.md)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

3456d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/72e647464b113116d1c99fd2b361bde2c55854108144938fbeab43aa25845eb0?d=identicon)[burntromi](/maintainers/burntromi)

---

Top Contributors

[![burntromi](https://avatars.githubusercontent.com/u/20435245?v=4)](https://github.com/burntromi "burntromi (20 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/burntromi-exception-generator/health.svg)

```
[![Health](https://phpackages.com/badges/burntromi-exception-generator/health.svg)](https://phpackages.com/packages/burntromi-exception-generator)
```

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M1.9k](/packages/behat-behat)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M648](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

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

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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