PHP code example of heartide / response
1. Go to this page and download the library: Download heartide/response 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/ */
heartide / response example snippets
use Hyperf\HttpServer\Contract\ResponseInterface;
use Heartide\Response\Response;
use Psr\Container\ContainerInterface;
/**
* @Inject
* @var Response
*/
protected $response;
class IndexController extends AbstractController
{
public function index()
{
$data = [
'order_id' => 1234
];
return $this->response->success($data);
}
}
bash
app/Controller/AbstractController.php