Download the PHP package fabiang/exception-generator without Composer

On this page you can find all versions of the php package fabiang/exception-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package exception-generator

Fabiang 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:

Exception Best Practices in PHP 5.3

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

Continuous Integration Latest Stable Version License Scrutinizer Code Quality Code Coverage

Installation/Usage

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

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

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?

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)

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

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

run PHPUnit:

run Behat:

License

MIT see LICENSE.md


All versions of exception-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
symfony/console Version ^6.0 || ^7.0
symfony/event-dispatcher Version ^6.0 || ^7.0
laminas/laminas-escaper Version ^2.12
laminas/laminas-filter Version ^2.31
laminas/laminas-servicemanager Version ^3.0 || ^2.2
laminas/laminas-view Version ^2.27
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package fabiang/exception-generator contains the following files

Loading the files please wait ....