PHP code example of vvinners / vapi

1. Go to this page and download the library: Download vvinners/vapi 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/ */

    

vvinners / vapi example snippets


VVinners\Vapi\VapiServiceProvider::class

use VVinners\Vapi\Api;

$api = new Api;
return $api->response(["result" => true], "OK");



return [

    'response_status' => [
        // HTTP_INTERNAL_SERVER_ERROR
        '500' => [
            'ERROR' => 'Error encountered'
        ],
    
        // HTTP_OK
        '200' => [
            'OK' => 'Success',
            'USER_NOT_FOUND' => 'User not found',
        ],
    
        // HTTP_BAD_REQUEST
        '400' => [
            'INVALID_DATA_INPUT' => 'Invalid data pass to server',
            'VALIDATION_ERROR' => 'Validation error',
        ],
    
        // HTTP_UNAUTHORIZED
        '401' => [
    
        ],
    
        // HTTP_FORBIDDEN
        '403' => [
    
        ]
    ],
    'msg_code_name' => 'msg_code',
    'msg_name' => 'msg',

];

bash
php artisan vendor:publish --provider="VVinners\Vapi\VapiServiceProvider" --tag=config