{"id":22747146,"url":"https://github.com/cs-eliseev/base-exceptions","last_synced_at":"2025-04-14T11:33:52.433Z","repository":{"id":56959765,"uuid":"184371831","full_name":"cs-eliseev/base-exceptions","owner":"cs-eliseev","description":"Provides simple work with exceptions for both development and production.","archived":false,"fork":false,"pushed_at":"2019-05-12T15:41:04.000Z","size":20,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T00:44:57.146Z","etag":null,"topics":["collection","collections","cse","error","errors","exception","exceptions","framework","helper","helpers","library","php","tool","tools","utilities","utility","utils"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cs-eliseev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-01T05:11:09.000Z","updated_at":"2022-10-01T18:06:03.000Z","dependencies_parsed_at":"2022-08-21T05:10:22.177Z","dependency_job_id":null,"html_url":"https://github.com/cs-eliseev/base-exceptions","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs-eliseev%2Fbase-exceptions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs-eliseev%2Fbase-exceptions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs-eliseev%2Fbase-exceptions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cs-eliseev%2Fbase-exceptions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cs-eliseev","download_url":"https://codeload.github.com/cs-eliseev/base-exceptions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248872198,"owners_count":21175367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collection","collections","cse","error","errors","exception","exceptions","framework","helper","helpers","library","php","tool","tools","utilities","utility","utils"],"created_at":"2024-12-11T03:13:22.417Z","updated_at":"2025-04-14T11:33:52.305Z","avatar_url":"https://github.com/cs-eliseev.png","language":"PHP","funding_links":["https://www.paypal.me/cseliseev/10usd"],"categories":[],"sub_categories":[],"readme":"English | [Русский](https://github.com/cs-eliseev/base-exceptions/blob/master/README.ru_RU.md)\n\nEXCEPTIONS CSE BASE\n=======\n\n[![Travis (.org)](https://img.shields.io/travis/cs-eliseev/base-exceptions.svg?style=flat-square)](https://travis-ci.org/cs-eliseev/base-exceptions)\n[![Codecov](https://img.shields.io/codecov/c/github/cs-eliseev/base-exceptions.svg?style=flat-square)](https://codecov.io/gh/cs-eliseev/base-exceptions)\n[![Scrutinizer code quality](https://img.shields.io/scrutinizer/g/cs-eliseev/base-exceptions.svg?style=flat-square)](https://scrutinizer-ci.com/g/cs-eliseev/base-exceptions/?branch=master)\n\n[![Packagist](https://img.shields.io/packagist/v/cse/base-exceptions.svg?style=flat-square)](https://packagist.org/packages/cse/base-exceptions)\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://packagist.org/packages/cse/base-exceptions)\n[![Packagist](https://img.shields.io/packagist/l/cse/base-exceptions.svg?style=flat-square)](https://github.com/cs-eliseev/base-exceptions/blob/master/LICENSE.md)\n[![GitHub repo size](https://img.shields.io/github/repo-size/cs-eliseev/base-exceptions.svg?style=flat-square)](https://github.com/cs-eliseev/base-exceptions/archive/master.zip)\n\nThis library provides a simple work with exceptions for both development and production.\n\nProject repository: https://github.com/cs-eliseev/base-exceptions\n\n**DEMO**\n```php\ntry {\n    ..\n    $code = 0;\n} catch (CseExceptions $e) {\n    ...\n} catch (Throwable $e) {\n    $code = $e-\u003egetCode();\n}\nCseExceptions::getErrorMsg($code);\n// Unknown error\n```\n\n***\n\n\n## Introduction\n\nCSE BASE is a set of libraries written in PHP specifically to extend your classes.\n\nA set of basic methods for creating your classes is what you need to quickly create web applications. \nEXCEPTIONS CSE BASE, allows you to extend classes with exceptions.\n\nCSE BASE was created for the rapid development of web applications.\n\n**CSE Base project:**\n* [Exceptions CSE base](https://github.com/cs-eliseev/base-exceptions)\n* [Singleton CSE base](https://github.com/cs-eliseev/base-singleton)\n\nBelow you will find some information on how to init library and perform common commands.\n\n\n## Install\n\nYou can find the most recent version of this project [here](https://github.com/cs-eliseev/base-exceptions).\n\n### Composer\n\nExecute the following command to get the latest version of the package:\n```bash\ncomposer require cse/base-exceptions\n```\n\nOr file composer.json should include the following contents:\n```json\n{\n    \"require\": {\n        \"cse/base-exceptions\": \"*\"\n    }\n}\n```\n\n### Git\n\nClone this repository locally:\n```bash\ngit clone https://github.com/cs-eliseev/base-exceptions.git\n```\n\n### Download\n\n[Download the latest release here](https://github.com/cs-eliseev/base-exceptions/archive/master.zip).\n\n\n## Usage\n\nView test model: [ModelExceptions.php](https://github.com/cs-eliseev/base-exceptions/blob/master/tests-data/ModelExceptions.php)\n\nSee examples: [examples-exceptions.php](https://github.com/cs-eliseev/base-exceptions/blob/master/examples/examples-exceptions.php)\n\n**Create Model Exception**\n\nExamples:\n```php\nclass ModelExceptions extends CseExceptions\n{\n    const ERROR_EXAMPLE_CODE_1 = 1;\n    const ERROR_EXAMPLE_CODE_2 = 2;\n    const ERROR_EXAMPLE_CODE_3 = 3;\n\n    /**\n     * @var array\n     */\n    protected static $errorsMsg = [\n        self::ERROR_EXAMPLE_CODE_1 =\u003e 'Error code 1',\n        self::ERROR_EXAMPLE_CODE_2 =\u003e 'Error code 2',\n        self::ERROR_EXAMPLE_CODE_3 =\u003e 'Error code 3',\n    ];\n}\n```\n\n**Use check instance**\n\nExamples:\n```php\ntry {\n    ...\n    throw new ModelExceptions('CseExceptions');\n} catch (CseExceptions $e) {\n    $e-\u003egetMessage();\n    // CseExceptions\n} catch (Exception $e) {\n    // Last Exception\n} catch (Throwable $e) {\n    // Last Throwable\n}\n```\n\n**Throw exception by code error**\n\nExamples:\n```php\nModelExceptions::throwException(ModelExceptions::ERROR_EXAMPLE_CODE_1);\n// Error code 1\n```\n\nAdd msg to exception:\n```php\nModelExceptions::throwException(ModelExceptions::ERROR_EXAMPLE_CODE_2, ' - msg test');\n// Error code 2 - msg test\n```\n\nDefault error msg:\n```php\nModelExceptions::throwException(4);\n// Unknown error\n```\n\n**Get error msg by code error**\n\nExamples:\n```php\nModelExceptions::getErrorMsg(ModelExceptions::ERROR_EXAMPLE_CODE_3);\n// Error code 3\n```\n\nDefault error msg:\n```php\nModelExceptions::getErrorMsg(4);\n// Unknown error\n```\n\n\n## Testing \u0026 Code Coverage\n\nPHPUnit is used for unit testing. Unit tests ensure that class and methods does exactly what it is meant to do.\n\nGeneral PHPUnit documentation can be found at https://phpunit.de/documentation.html.\n\nTo run the PHPUnit unit tests, execute:\n```bash\nphpunit PATH/TO/PROJECT/tests/\n```\n\nIf you want code coverage reports, use the following:\n```bash\nphpunit --coverage-html ./report PATH/TO/PROJECT/tests/\n```\n\nUsed PHPUnit default config:\n```bash\nphpunit --configuration PATH/TO/PROJECT/phpunit.xml\n```\n\n\n## Donating\n\nYou can support this project [here](https://www.paypal.me/cseliseev/10usd). \nYou can also help out by contributing to the project, or reporting bugs. \nEven voicing your suggestions for features is great. Anything to help is much appreciated.\n\n\n## License\n\nThe 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.\n\n***\n\n\u003e GitHub [@cs-eliseev](https://github.com/cs-eliseev)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcs-eliseev%2Fbase-exceptions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcs-eliseev%2Fbase-exceptions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcs-eliseev%2Fbase-exceptions/lists"}