PHP code example of jakson-fischer / returns

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

    

jakson-fischer / returns example snippets


use JaksonFischer\Returns\Returns;

echo Returns::toJson(true, "Test success message", NULL, NULL, 200);

return Returns::toArray(false, "Cliente não está autenticado no sistema!", "#EA1527", "Erro de sistema", 511);

[
    "status" => false, 
    "msg" => "Cliente não está autenticado no sistema!", 
    "errorCode" => "#EA1527", 
    "errorType" => "Erro de sistema", 
    "httpStatus" => 511 
]

return Returns::toJson(false, "Cliente não está autenticado no sistema!", "#EA1527", "Erro de sistema", 511);

Returns::arrayDataReturn(false, "Cliente não está autenticado no sistema!", "#EA1527", "Erro de sistema", 511);

[
    "data" => [
        "status" => false,
        "msg" => "Cliente não está autenticado no sistema!",
        "errorCode" => "#EA1527",
        "errorType" => "Erro de sistema",
        "httpStatus" => 511
    ]
]

Returns::jsonDataReturn(false, "Cliente não está autenticado no sistema!", "#EA1527", "Erro de sistema", 511);

use JaksonFischer\Returns\Returns;

echo Returns::toJson(true, "Test success message", NULL, NULL, 200);

return Returns::toArray(false, "Client is not authenticated in the system!", "#EA1527", "System error", 511);

[
    "status" => false, 
    "msg" => "Client is not authenticated in the system!", 
    "errorCode" => "#EA1527", 
    "errorType" => "System error", 
    "httpStatus" => 511 
]

return Returns::toJson(false, "Client is not authenticated in the system!", "#EA1527", "System error", 511);

Returns::arrayDataReturn(false, "Client is not authenticated in the system!", "#EA1527", "System error", 511);

[
    "data" => [
        "status" => false,
        "msg" => "Client is not authenticated in the system!",
        "errorCode" => "#EA1527",
        "errorType" => "System error",
        "httpStatus" => 511
    ]
]

Returns::jsonDataReturn(false, "Client is not authenticated in the system!", "#EA1527", "System error", 511);