Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Latest commit

 

History

History
79 lines (53 loc) · 1.64 KB

5.x_6.x.md

File metadata and controls

79 lines (53 loc) · 1.64 KB

Upgrading To 6.x From 5.x

PHP 7.3 Required

The new minimum PHP version is now 7.3.

Updating Dependencies

Update your andrey-helldar/api-response dependency to ^6.0 in your composer.json file.

api_response function

Changed the order of api_response function attributes from:

function api_response(
    $data = null,
    int $status_code = 200,
    array $headers = [], // here
    array $with = [],    // here
    bool $use_data = true
)

to:

function api_response(
    $data = null,
    int $status_code = 200,
    array $with = [],    // here
    array $headers = [], // here
    bool $use_data = true
)

The status method

The status method from Helldar\ApiResponse\Services\Response has been removed.

The data method

data method from Helldar\ApiResponse\Services\Response added status code attribute:

function data(
    $data = null,
    int $status_code = 200,
    bool $use_data = true
)

For the Laravel and Lumen Frameworks

This method works only with the Laravel and Lumen frameworks 7.0 and above.

If you use the Laravel or Lumen framework, you can update the extends in the app\Exceptions\Handler.php file to Helldar\ApiResponse\Support\LaravelException.

If you did not add anything to this file, then delete everything properties and methods.

As a result, a clean file will look like this:

<?php

namespace App\Exceptions;

use Helldar\ApiResponse\Support\LaravelException as ExceptionHandler;

class Handler extends ExceptionHandler
{
    //
}

Or you can change this file by adding code to it, similar to ours.