PHP code example of soloslee / json-response

1. Go to this page and download the library: Download soloslee/json-response library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

soloslee / json-response example snippets


'Soloslee\JsonResponse\JsonResponseServiceProvider::class',

'JsonResponse' => Soloslee\JsonResponse\Facades\JsonResponse::class,

use Soloslee\JsonResponse\JsonResponse;

return JsonResponse::success();

JsonResponse::success([
    'id' => $user->id,
    'phone' => $user->phone,
    'email' => $user->email,
    'authorized' => $user->cleaner,
    'token' => $user->token
]);

JsonResponse::error('Fails to send message.', 602);