PHPackages                             sqrt-pro/exception - 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. sqrt-pro/exception

ActiveLibrary[Framework](/categories/framework)

sqrt-pro/exception
==================

Basic Exception class is a part of SQRT Framework

0.1(11y ago)01.5k3MITPHPPHP &gt;=5.3.0

Since Sep 16Pushed 10y ago2 watchersCompare

[ Source](https://github.com/sqrt-pro/Exception)[ Packagist](https://packagist.org/packages/sqrt-pro/exception)[ Docs](http://fw.sqrt.pro)[ RSS](/packages/sqrt-pro-exception/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (3)

SQRT\\Exception
===============

[](#sqrtexception)

Класс **SQRT\\Exception** позволяет удобно работать с текстами ошибок в исключениях, используя подстановку по коду ошибки и функционал шаблонов sprintf.

Например, создадим класс-наследник содержащий тексты и шаблоны ошибок:

```
    class TestException extends \SQRT\Exception
    {
      const ERR_ONE = 1;
      const ERR_TWO = 2;

      protected static $errors_arr = array(
        self::ERR_ONE => 'Текст ошибки номер один',
        self::ERR_TWO => 'Текст ошибки %s с подстановкой %s',
      );
    }

```

Теперь можно формировать тексты ошибок по коду исключения:

```
    echo TestException::GetNameForCode(TestException::ERR_ONE);
    // Вывод: Текст ошибки номер один

    echo TestException::GetNameForCode(TestException::ERR_TWO, array('#2', 'значений');
    echo TestException::GetNameForCode(TestException::ERR_TWO, '#2', 'значений');
    // Оба вызова дадут вывод: Текст ошибки #2 с подстановкой значений

```

Или сразу выбрасывать Exception с нужными свойствами:

```
    try {
        TestException::ThrowError(TestException::ERR_TWO, '#2', 'значений');
    } catch (TestException $e) {
        echo $e->getMessage(); // Текст ошибки #2 с подстановкой значений
        echo $e->getCode(); // 2 (Значение TestException::ERR_TWO)
    }

```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity48

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

4308d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8718914?v=4)[Квадратный Корень](/maintainers/sqrt-pro)[@sqrt-pro](https://github.com/sqrt-pro)

---

Top Contributors

[![cmsx](https://avatars.githubusercontent.com/u/2027189?v=4)](https://github.com/cmsx "cmsx (3 commits)")

### Embed Badge

![Health badge](/badges/sqrt-pro-exception/health.svg)

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

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k39.6M300](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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