PHP code example of diegoalvarezb / laravel-service-utils

1. Go to this page and download the library: Download diegoalvarezb/laravel-service-utils 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/ */

    

diegoalvarezb / laravel-service-utils example snippets


Diegoalvarezb\FrontMessages\ServiceUtilsServiceProvider::class

return $this->generateResponse($data = [], $errorCode = 'NO_ERROR', $message = '');

$this->logException($exception, $type = 'error', $customMessage = '');



use Symfony\Component\HttpFoundation\Response;

return [

    /*
     * Error code list for service response interface.
     */
    'service_codes' => [

        'NOT_ERROR' => [
            'is_error' => false,
            'message' => 'Ok.',
            'http_code' => Response::HTTP_OK,
            'is_critial' => false,
        ],

        'GENERAL_ERROR' => [
            'is_error' => true,
            'message' => 'General error.',
            'http_code' => Response::HTTP_INTERNAL_SERVER_ERROR,
            'is_critial' => false,
        ],

        'NEW_ERROR' => [
            'is_error' => true,
            'message' => 'Text example of a new error.',
            'http_code' => Response::HTTP_INTERNAL_SERVER_ERROR,
            'is_critial' => true,
        ],

    ],

];
sh
php artisan vendor:publish --tag=service-utils