Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .codecov.yml

This file was deleted.

1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
39 changes: 0 additions & 39 deletions .github/workflows/coverage.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ on: [ push ]

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
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
Expand All @@ -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
Expand Down
48 changes: 16 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,74 +1,58 @@
# Laravel Json Response

Automatically always return a response in JSON format

<img src="https://preview.dragon-code.pro/TheDragonCode/json-response.svg?brand=laravel" alt="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`.

```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
5 changes: 0 additions & 5 deletions SECURITY.md

This file was deleted.

16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"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",
"keywords": [
"api",
"json",
"laravel",
"response"
"response",
"dragon-code",
"dragon",
"andrey-helldar"
],
"authors": [
{
Expand All @@ -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",
Expand All @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/Middlewares/SetHeaderMiddleware.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace Helldar\LaravelJsonResponse\Middlewares;
namespace DragonCode\LaravelJsonResponse\Middlewares;

use Closure;
use Illuminate\Http\Request;

final class SetHeaderMiddleware
class SetHeaderMiddleware
{
public function handle(Request $request, Closure $next)
{
Expand Down
6 changes: 3 additions & 3 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Helldar\LaravelJsonResponse;
namespace DragonCode\LaravelJsonResponse;

use Helldar\LaravelJsonResponse\Middlewares\SetHeaderMiddleware;
use DragonCode\LaravelJsonResponse\Middlewares\SetHeaderMiddleware;
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;

final class ServiceProvider extends BaseServiceProvider
class ServiceProvider extends BaseServiceProvider
{
protected $groups = ['web', 'api'];

Expand Down
4 changes: 2 additions & 2 deletions tests/Middlewares/DuplicateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Tests\Middlewares;

use Helldar\LaravelJsonResponse\Middlewares\SetHeaderMiddleware;
use DragonCode\LaravelJsonResponse\Middlewares\SetHeaderMiddleware;
use Tests\TestCase;

final class DuplicateTest extends TestCase
class DuplicateTest extends TestCase
{
public function testCount()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Middlewares/SetHeaderMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Tests\TestCase;

final class SetHeaderMiddlewareTest extends TestCase
class SetHeaderMiddlewareTest extends TestCase
{
public function testWeb(): void
{
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Tests;

use Helldar\LaravelJsonResponse\ServiceProvider;
use DragonCode\LaravelJsonResponse\ServiceProvider;
use Illuminate\Contracts\Http\Kernel;
use Orchestra\Testbench\TestCase as BaseTestCase;

Expand Down