Skip to content

Instantly share code, notes, and snippets.

View mriso79's full-sized avatar
🏠
Working from home - forever

mriso79 mriso79

🏠
Working from home - forever
  • in the shadows
  • São José dos Campos
  • X @mriso79
View GitHub Profile
@mriso79
mriso79 / JsonResponse.php
Created December 27, 2018 22:12
A decent JSON response with Charset UTF-8 with PHP
<?php
namespace lib\http;
class JsonResponse {
function __construct(){}
public static function simpleJsonResponse($object){
header('Content-Type: application/json; charset=utf-8');
echo json_encode($object, JSON_FORCE_OBJECT);
}