From 274a956de87fce6e21c037698b0b9ab09c3777b3 Mon Sep 17 00:00:00 2001 From: mojtaba rakhisi Date: Thu, 21 Jan 2021 17:39:09 +0330 Subject: [PATCH] rename namespace --- README.md | 51 ++----------------- composer.json | 16 ++---- src/Contracts/ApiExceptionAbstract.php | 6 +-- .../CustomAuthenticationException.php | 4 +- src/Exceptions/CustomDefaultException.php | 4 +- .../CustomModelNotFoundException.php | 4 +- .../CustomNotFoundHttpException.php | 4 +- .../CustomRouteNotFoundException.php | 4 +- .../CustomUnauthorizedException.php | 4 +- src/Exceptions/CustomUnexpectedException.php | 4 +- src/Exceptions/CustomValidationException.php | 4 +- src/Handlers/ApiException.php | 6 +-- src/Providers/ApiExceptionServiceProvider.php | 2 +- src/config/exceptions.php | 12 ++--- tests/BaseTestCase.php | 4 +- tests/Feature/HandlerTest.php | 18 +++---- .../CustomAuthenticationExceptionTest.php | 6 +-- tests/Unit/CustomDefaultExceptionTest.php | 6 +-- .../Unit/CustomModelNotFoundExceptionTest.php | 6 +-- .../Unit/CustomNotFoundHttpExceptionTest.php | 6 +-- .../Unit/CustomRouteNotFoundExceptionTest.php | 8 +-- .../Unit/CustomUnauthorizedExceptionTest.php | 6 +-- tests/Unit/CustomUnexpectedExceptionTest.php | 6 +-- 23 files changed, 71 insertions(+), 120 deletions(-) diff --git a/README.md b/README.md index db9c472..28f6b54 100755 --- a/README.md +++ b/README.md @@ -2,58 +2,15 @@ a lightweight package for create and pass response for use in laravel || lumen -### Prerequisites - -before start, you should have personal access token and SSH key. - -* [how to create SSH-key](https://docs.gitlab.com/ee/ssh/README.html#generating-a-new-ssh-key-pair) -* [how to create personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#creating-a-personal-access-token) - -next you should add your personal access token to composer - -``` -$ composer config \ - --auth gitlab-token.gitlab.com "YOUR-TOKEN-HERE" \ - --no-ansi \ - --no-interaction -``` - -If you prefer to do this manually, create ~/.composer/auth.json, with the following content: -``` -{ - "gitlab-token": { - "gitlab.com": "YOUR-TOKEN-HERE" - } -} -``` ### Installation -easily copy below code and paste in your `composer.json` - -``` -"repositories": { - "liateam/api-exceptions" : { - "type": "vcs", - "url": "git@git.liateam.net:php/packages/api-exceptions.git" - } - }, -``` - -easily copy below code and paste in your `composer.json` -> `require` section - -``` -"liateam/api-exceptions": "^2.0" -``` - -run the command below in your project : - ``` -$ composer update +$ composer require mojtabarks/api-exceptions ``` ### lumen specific installation -if your project is lumen so you should copy `Liateam/api-exceptions/src/config/exceptions` to your `config` directory ! +if your project is lumen so you should copy `mojtabarks/api-exceptions/src/config/exceptions` to your `config` directory ! *NOTE* : If you don't have `config` directory so create it ! then add below code in your `bootstrap/app.php` : @@ -63,7 +20,7 @@ then add below code in your `bootstrap/app.php` : ### laravel specific installation ``` -$ php artisan vendor:publish --config="Liateam/api-exceptions/src/config/exceptions.php" +$ php artisan vendor:publish --provider="Mojtabarks/ApiExceptions/Providers/ApiExceptionServiceProvider" ``` @@ -71,7 +28,7 @@ $ php artisan vendor:publish --config="Liateam/api-exceptions/src/config/excepti overwrite `render` method of `App\Exceptions\Handler` like this : ``` - use Liateam\ApiExceptions\Handlers\ApiException; + use Mojtabarks\ApiExceptions\Handlers\ApiException; public function render($request, Throwable $exception) { diff --git a/composer.json b/composer.json index a5076a3..425ec46 100755 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "liateam/api-exceptions", + "name": "mojtabarks/api-exceptions", "description": "Exception list using in api which help you to easy manage your api exceptions", "type": "library", "license": "MIT", @@ -10,24 +10,18 @@ } ], "require": { - "liateam/api-response": "2.*" - }, - "repositories": { - "liateam/api-response" : { - "type": "vcs", - "url": "git@git.liateam.net:php/packages/api-response.git" - } + "mojtabarks/api-response": "2.*" }, "autoload": { "psr-4": { - "Liateam\\ApiExceptions\\": "src", - "Liateam\\ApiExceptions\\Tests\\" : "tests" + "Mojtabarks\\ApiExceptions\\": "src", + "Mojtabarks\\ApiExceptions\\Tests\\" : "tests" } }, "extra": { "laravel": { "providers": [ - "Liateam\\ApiExceptions\\Providers\\ApiExceptionServiceProvider" + "Mojtabarks\\ApiExceptions\\Providers\\ApiExceptionServiceProvider" ] } } diff --git a/src/Contracts/ApiExceptionAbstract.php b/src/Contracts/ApiExceptionAbstract.php index ce2c411..4dbfcb2 100755 --- a/src/Contracts/ApiExceptionAbstract.php +++ b/src/Contracts/ApiExceptionAbstract.php @@ -1,11 +1,11 @@