PHP code example of xervice / api
1. Go to this page and download the library: Download xervice/api 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/ */
xervice / api example snippets
namespace App\MyModule\Communication\Controller;
use \DataProvider\MyDataDataProvider;
use Symfony\Component\HttpFoundation\Response;
use Xervice\Api\Communication\Controller\AbstractApiController;
class MyApiController extends AbstractApiController
{
/**
* @param \DataProvider\MyDataDataProvider $dataProvider
* @param string $name
*
* @return \Symfony\Component\HttpFoundation\Response
* @throws \Xervice\Api\Exception\ApiException
*/
public function myRequestAction(MyDataDataProvider $dataProvider, string $name): Response
{
$dataProvider = $this->getFacade()->doAnythingWithData($dataProvider);
return $this->apiResponse($dataProvider);
}
}