PHP code example of ahmeti / response-service
1. Go to this page and download the library: Download ahmeti/response-service 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/ */
ahmeti / response-service example snippets
namespace App\Http\Controllers;
use Ahmeti\ResponseService\Facades\ResponseService;
use App\Http\Controllers\Controller;
class IndexController extends Controller
{
public function index()
{
return ResponseService::status(true)
->message('Hi Dear!')
->send();
}
}
namespace App\Http\Controllers;
use Ahmeti\ResponseService\Facades\ResponseService;
use App\Http\Controllers\Controller;
class IndexController extends Controller
{
public function index()
{
return ResponseService::status(true)
->message('Hi Dear!')
->data(['key1'=>'value1', 'key2'=>'value2'])
->statusCode('CODE100')
->responseCode(200)
->send();
}
}