PHP code example of dyonis / symfony-api-response
1. Go to this page and download the library: Download dyonis/symfony-api-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/ */
dyonis / symfony-api-response example snippets
return (new ApiResponse())
->setData(['product' => $product])
->setMessage('Successfully saved');
return (new ApiResponse())
->apiRedirect('https://some.url', 302);
$response = new ApiResponse();
$response->addErrors(['Error 1', 'Error 2'])
$response->addError('Error 3');
$response->addError('Error 4', 'Field');
return $response