From a8a0e43b66bca494d6a2999cbd91b4666a97b731 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 16 Nov 2021 23:34:18 +0300 Subject: [PATCH 1/3] Changed namespace --- .codecov.yml | 1 - .github/workflows/coverage.yml | 39 --------------- .github/workflows/phpunit.yml | 4 +- README.md | 48 +++++++------------ SECURITY.md | 5 -- composer.json | 16 +++++-- src/Middlewares/SetHeaderMiddleware.php | 4 +- src/ServiceProvider.php | 6 +-- tests/Middlewares/DuplicateTest.php | 4 +- tests/Middlewares/SetHeaderMiddlewareTest.php | 2 +- tests/TestCase.php | 2 +- 11 files changed, 38 insertions(+), 93 deletions(-) delete mode 100644 .codecov.yml delete mode 100644 .github/workflows/coverage.yml delete mode 100644 SECURITY.md diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index db24720..0000000 --- a/.codecov.yml +++ /dev/null @@ -1 +0,0 @@ -comment: off diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index bda7203..0000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: coverage -on: - push: - branches: - - main - - coverage - -jobs: - scrutinizer: - runs-on: ubuntu-20.04 - - name: Coverage - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 7.4 - extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, bcmath - coverage: xdebug - - - name: Composer self update - run: composer self-update - - - name: Install dependencies - run: composer update --prefer-stable --prefer-dist --no-progress --no-interaction - - - name: Execute tests - run: | - mkdir -p build/logs - sudo vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover - - - name: Export - run: | - wget https://scrutinizer-ci.com/ocular.phar - sudo php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index ab9414a..5cc040c 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -3,7 +3,7 @@ on: [ push ] jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: fail-fast: true @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | - composer require laravel/framework:^${{ matrix.laravel }} + composer require --dev laravel/framework:^${{ matrix.laravel }} composer update --prefer-stable --prefer-dist --no-progress --no-interaction - name: Execute tests diff --git a/README.md b/README.md index 1a72199..a5c533a 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,21 @@ # Laravel Json Response -Automatically always return a response in JSON format - Laravel Json Response [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] [![Total Downloads][badge_downloads]][link_packagist] -[![License][badge_license]][link_license] - -[![StyleCI Status][badge_styleci]][link_styleci] [![Github Workflow Status][badge_build]][link_build] -[![Coverage Status][badge_coverage]][link_scrutinizer] -[![Scrutinizer Code Quality][badge_quality]][link_scrutinizer] +[![License][badge_license]][link_license] +> Automatically always return a response in JSON format ## Installation To get the latest version of `Laravel Json Response`, simply require the project using [Composer](https://getcomposer.org): ```bash -$ composer require andrey-helldar/laravel-json-response +$ composer require dragon-code/laravel-json-response ``` Or manually update `require` block of `composer.json` and run `composer update`. @@ -28,47 +23,36 @@ Or manually update `require` block of `composer.json` and run `composer update`. ```json { "require": { - "andrey-helldar/laravel-json-response": "^1.0" + "dragon-code/laravel-json-response": "^1.0" } } ``` +### Upgrade from `andrey-helldar/laravel-json-response` + +1. Replace `"andrey-helldar/laravel-json-response": "^1.0"` with `"dragon-code/laravel-json-response": "^2.0"` in the `composer.json` file; +4. Call the `composer update` console command. + ## Using After you've installed the package via composer, you're done. There's no step two. -This package will automatically register the `Helldar\LaravelJsonResponse\Middlewares\SetHeaderMiddleware` middleware in the `web` and `api` groups, if they +This package will automatically register the `DragonCode\LaravelJsonResponse\Middlewares\SetHeaderMiddleware` middleware in the `web` and `api` groups, if they exist. The middleware will add a header `Accept` that will effectively convert all responses to JSON format. This header will apply to all responses. -## For Enterprise - -Available as part of the Tidelift Subscription. -The maintainers of `andrey-helldar/laravel-json-response` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more](https://tidelift.com/subscription/pkg/packagist-andrey-helldar-laravel-json-response?utm_source=packagist-andrey-helldar-laravel-json-response&utm_medium=referral&utm_campaign=enterprise&utm_term=repo). +[badge_build]: https://img.shields.io/github/workflow/status/dragon-code/laravel-json-response/phpunit?style=flat-square +[badge_downloads]: https://img.shields.io/packagist/dt/dragon-code/laravel-json-response.svg?style=flat-square -[badge_build]: https://img.shields.io/github/workflow/status/andrey-helldar/laravel-json-response/phpunit?style=flat-square +[badge_license]: https://img.shields.io/packagist/l/dragon-code/laravel-json-response.svg?style=flat-square -[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/andrey-helldar/laravel-json-response.svg?style=flat-square - -[badge_downloads]: https://img.shields.io/packagist/dt/andrey-helldar/laravel-json-response.svg?style=flat-square - -[badge_license]: https://img.shields.io/packagist/l/andrey-helldar/laravel-json-response.svg?style=flat-square - -[badge_quality]: https://img.shields.io/scrutinizer/g/andrey-helldar/laravel-json-response.svg?style=flat-square - -[badge_stable]: https://img.shields.io/github/v/release/andrey-helldar/laravel-json-response?label=stable&style=flat-square - -[badge_styleci]: https://styleci.io/repos/374687566/shield +[badge_stable]: https://img.shields.io/github/v/release/dragon-code/laravel-json-response?label=stable&style=flat-square [badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square -[link_build]: https://github.com/andrey-helldar/laravel-json-response/actions +[link_build]: https://github.com/dragon-code/laravel-json-response/actions [link_license]: LICENSE -[link_packagist]: https://packagist.org/packages/andrey-helldar/laravel-json-response - -[link_scrutinizer]: https://scrutinizer-ci.com/g/andrey-helldar/laravel-json-response/?branch=main - -[link_styleci]: https://github.styleci.io/repos/374687566 +[link_packagist]: https://packagist.org/packages/dragon-code/laravel-json-response diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 7ad007f..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,5 +0,0 @@ -# Security Policy - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). - -Tidelift will coordinate the fix and disclosure. diff --git a/composer.json b/composer.json index 8924122..773cb75 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "andrey-helldar/laravel-json-response", + "name": "dragon-code/laravel-json-response", "description": "Automatically always return a response in JSON format", "type": "library", "license": "MIT", @@ -7,7 +7,10 @@ "api", "json", "laravel", - "response" + "response", + "dragon-code", + "dragon", + "andrey-helldar" ], "authors": [ { @@ -16,8 +19,8 @@ } ], "support": { - "issues": "https://github.com/andrey-helldar/laravel-json-response/issues", - "source": "https://github.com/andrey-helldar/laravel-json-response" + "issues": "https://github.com/TheDragonCode/laravel-json-response/issues", + "source": "https://github.com/TheDragonCode/laravel-json-response" }, "require": { "php": "^7.3|^8.0", @@ -29,9 +32,12 @@ "orchestra/testbench": "^4.0|^5.0|^6.0", "phpunit/phpunit": "^9.0" }, + "conflict": { + "andrey-helldar/laravel-json-response": "*" + }, "autoload": { "psr-4": { - "Helldar\\LaravelJsonResponse\\": "src" + "DragonCode\\LaravelJsonResponse\\": "src" } }, "autoload-dev": { diff --git a/src/Middlewares/SetHeaderMiddleware.php b/src/Middlewares/SetHeaderMiddleware.php index c0d6216..ff52e56 100644 --- a/src/Middlewares/SetHeaderMiddleware.php +++ b/src/Middlewares/SetHeaderMiddleware.php @@ -1,11 +1,11 @@ Date: Tue, 16 Nov 2021 23:34:42 +0300 Subject: [PATCH 2/3] Update PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 071d342..8efa1cb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,4 +3,3 @@ Pull requests without a descriptive title, thorough description, or tests will b In addition, please describe the benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc. --> -f From 1fb74d457235ca2e1d8890ac69e86001a47e0722 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 16 Nov 2021 23:35:14 +0300 Subject: [PATCH 3/3] Update phpunit.yml --- .github/workflows/phpunit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 5cc040c..7076522 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -11,7 +11,7 @@ jobs: php: [ "7.3", "7.4", "8.0" ] laravel: [ "6.0", "7.0", "8.0" ] - name: Laravel ${{ matrix.laravel }}, PHP ${{ matrix.php }} + name: PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }} steps: - name: Checkout code