PHP code example of igordrangel / gambiel-response-query
1. Go to this page and download the library: Download igordrangel/gambiel-response-query 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/ */
igordrangel / gambiel-response-query example snippets
bash
class BancosController{
/**
* @Route("/users", methods={"GET"})
* @param Request $request
* @return Response
*/
public function get(Request $request): Response {
$params = $request->query->all();
$skeleton = json_decode($request->headers->get('query') ?? '', true);
$result = [
"users" => []
];
// Here you can use your permission service to validate if can return a data or not
$showEmail = false;
foreach ($this->userRepository->Search() as $user) {
array_push($result['users'], ResponseQuery::query(
ResponseQuery::new(
ResponseQuery::add("id",$user->getId()),
ResponseQuery::add("name",$user->getName()),
ResponseQuery::add("email",$user->getEmail(), $showEmail),
ResponseQuery::add("status",$user->getStatus())
),
$skeleton
));
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.