1. Go to this page and download the library: Download bugraozkan/json-php 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/ */
bugraozkan / json-php example snippets
JsonPhp\ApiResponse;
// Create an API response instance
$response = ApiResponse::create();
// Add data to the response
$response->setData([
'name' => 'Bugra',
'surname' => 'Ozkan',
'age' => 21
]);
// Set the HTTP status code
$response->setStatus(200);
// Send the JSON response
$response->send();