PHPackages                             cse/base-exceptions - 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. [Framework](/categories/framework)
4. /
5. cse/base-exceptions

ActiveLibrary[Framework](/categories/framework)

cse/base-exceptions
===================

This library provides a simple work with exceptions for both development and production.

1.0.0(7y ago)795022MITPHPPHP &gt;=7.1

Since May 2Pushed 7y ago3 watchersCompare

[ Source](https://github.com/cs-eliseev/base-exceptions)[ Packagist](https://packagist.org/packages/cse/base-exceptions)[ Docs](https://github.com/cs-eliseev/base-exceptions)[ RSS](/packages/cse-base-exceptions/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (2)

English | [Русский](https://github.com/cs-eliseev/base-exceptions/blob/master/README.ru_RU.md)

EXCEPTIONS CSE BASE
===================

[](#exceptions-cse-base)

[![Travis (.org)](https://camo.githubusercontent.com/b899a28ed198f40e25bc8589d1e19d6e4b6d638cb9f2d78bb79276573793e738/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f63732d656c69736565762f626173652d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/cs-eliseev/base-exceptions)[![Codecov](https://camo.githubusercontent.com/92215ec3a18f1cbd7caf80cccd803f4cf25d6a63f3b653f50964cd07fff56b13/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f63732d656c69736565762f626173652d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/cs-eliseev/base-exceptions)[![Scrutinizer code quality](https://camo.githubusercontent.com/d13e5f429183bb66157066454cca10b0dd281d7f9adb96ccbcdca7b3aecc7412/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f63732d656c69736565762f626173652d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/cs-eliseev/base-exceptions/?branch=master)

[![Packagist](https://camo.githubusercontent.com/9523ff2427528a308d382cafb84ab74003339982888f6378d4dfc9752de05bdb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6373652f626173652d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cse/base-exceptions)[![Minimum PHP Version](https://camo.githubusercontent.com/dcd4b4aec2c1709157fa6a2c050f709d75cde9552a79cfff0b70a97fad7281ae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cse/base-exceptions)[![Packagist](https://camo.githubusercontent.com/a09bcd96d8b94d2b1aa7e36d83b57685048aa8afe3c05e8ea3619c47259fbc18/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6373652f626173652d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://github.com/cs-eliseev/base-exceptions/blob/master/LICENSE.md)[![GitHub repo size](https://camo.githubusercontent.com/f822ed0eaaa9a0157af8dc6b03c28cec577a6ca131ef28a2b8a9f80fa94db815/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f63732d656c69736565762f626173652d657863657074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://github.com/cs-eliseev/base-exceptions/archive/master.zip)

This library provides a simple work with exceptions for both development and production.

Project repository:

**DEMO**

```
try {
    ..
    $code = 0;
} catch (CseExceptions $e) {
    ...
} catch (Throwable $e) {
    $code = $e->getCode();
}
CseExceptions::getErrorMsg($code);
// Unknown error
```

---

Introduction
------------

[](#introduction)

CSE BASE is a set of libraries written in PHP specifically to extend your classes.

A set of basic methods for creating your classes is what you need to quickly create web applications. EXCEPTIONS CSE BASE, allows you to extend classes with exceptions.

CSE BASE was created for the rapid development of web applications.

**CSE Base project:**

- [Exceptions CSE base](https://github.com/cs-eliseev/base-exceptions)
- [Singleton CSE base](https://github.com/cs-eliseev/base-singleton)

Below you will find some information on how to init library and perform common commands.

Install
-------

[](#install)

You can find the most recent version of this project [here](https://github.com/cs-eliseev/base-exceptions).

### Composer

[](#composer)

Execute the following command to get the latest version of the package:

```
composer require cse/base-exceptions
```

Or file composer.json should include the following contents:

```
{
    "require": {
        "cse/base-exceptions": "*"
    }
}
```

### Git

[](#git)

Clone this repository locally:

```
git clone https://github.com/cs-eliseev/base-exceptions.git
```

### Download

[](#download)

[Download the latest release here](https://github.com/cs-eliseev/base-exceptions/archive/master.zip).

Usage
-----

[](#usage)

View test model: [ModelExceptions.php](https://github.com/cs-eliseev/base-exceptions/blob/master/tests-data/ModelExceptions.php)

See examples: [examples-exceptions.php](https://github.com/cs-eliseev/base-exceptions/blob/master/examples/examples-exceptions.php)

**Create Model Exception**

Examples:

```
class ModelExceptions extends CseExceptions
{
    const ERROR_EXAMPLE_CODE_1 = 1;
    const ERROR_EXAMPLE_CODE_2 = 2;
    const ERROR_EXAMPLE_CODE_3 = 3;

    /**
     * @var array
     */
    protected static $errorsMsg = [
        self::ERROR_EXAMPLE_CODE_1 => 'Error code 1',
        self::ERROR_EXAMPLE_CODE_2 => 'Error code 2',
        self::ERROR_EXAMPLE_CODE_3 => 'Error code 3',
    ];
}
```

**Use check instance**

Examples:

```
try {
    ...
    throw new ModelExceptions('CseExceptions');
} catch (CseExceptions $e) {
    $e->getMessage();
    // CseExceptions
} catch (Exception $e) {
    // Last Exception
} catch (Throwable $e) {
    // Last Throwable
}
```

**Throw exception by code error**

Examples:

```
ModelExceptions::throwException(ModelExceptions::ERROR_EXAMPLE_CODE_1);
// Error code 1
```

Add msg to exception:

```
ModelExceptions::throwException(ModelExceptions::ERROR_EXAMPLE_CODE_2, ' - msg test');
// Error code 2 - msg test
```

Default error msg:

```
ModelExceptions::throwException(4);
// Unknown error
```

**Get error msg by code error**

Examples:

```
ModelExceptions::getErrorMsg(ModelExceptions::ERROR_EXAMPLE_CODE_3);
// Error code 3
```

Default error msg:

```
ModelExceptions::getErrorMsg(4);
// Unknown error
```

Testing &amp; Code Coverage
---------------------------

[](#testing--code-coverage)

PHPUnit is used for unit testing. Unit tests ensure that class and methods does exactly what it is meant to do.

General PHPUnit documentation can be found at .

To run the PHPUnit unit tests, execute:

```
phpunit PATH/TO/PROJECT/tests/
```

If you want code coverage reports, use the following:

```
phpunit --coverage-html ./report PATH/TO/PROJECT/tests/
```

Used PHPUnit default config:

```
phpunit --configuration PATH/TO/PROJECT/phpunit.xml
```

Donating
--------

[](#donating)

You can support this project [here](https://www.paypal.me/cseliseev/10usd). You can also help out by contributing to the project, or reporting bugs. Even voicing your suggestions for features is great. Anything to help is much appreciated.

License
-------

[](#license)

The EXCEPTIONS CSE BASE is open-source PHP library licensed under the MIT license. Please see [License File](https://github.com/cs-eliseev/base-exceptions/blob/master/LICENSE.md) for more information.

---

> GitHub [@cs-eliseev](https://github.com/cs-eliseev)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity55

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

Unknown

Total

1

Last Release

2617d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3b9e49d0ce3fd71c8eb31b7c14e48373dbb415a9d16950ce52d23bf89b2ae26?d=identicon)[ak\_eliseev](/maintainers/ak_eliseev)

---

Top Contributors

[![cs-eliseev](https://avatars.githubusercontent.com/u/24221291?v=4)](https://github.com/cs-eliseev "cs-eliseev (26 commits)")

---

Tags

collectioncollectionscseerrorerrorsexceptionexceptionsframeworkhelperhelperslibraryphptooltoolsutilitiesutilityutilsframeworkhelperutilityhelperslibraryexceptionerrorerrorsexceptionstoolcollectioncollectionstoolsutilsutilitiescse

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cse-base-exceptions/health.svg)

```
[![Health](https://phpackages.com/badges/cse-base-exceptions/health.svg)](https://phpackages.com/packages/cse-base-exceptions)
```

###  Alternatives

[graham-campbell/exceptions

Provides A Powerful Error Response System For Both Development And Production

5871.3M4](/packages/graham-campbell-exceptions)[jbzoo/utils

Collection of PHP functions, mini classes and snippets for everyday developer's routine life.

8151.6M36](/packages/jbzoo-utils)[dragon-code/support

Support package is a collection of helpers and tools for any project.

2310.1M106](/packages/dragon-code-support)

PHPackages © 2026

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