1. Go to this page and download the library: Download youngmayor/app-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/ */
// ...
use YoungMayor\AppResponse\API;
// ...
class SampleController extends Controller
{
public function sampleMethod(API $api)
{
// ...
return $api->success("Action was successful");
}
}
// ...
use YoungMayor\AppResponse\Web;
// ...
class SampleController extends Controller
{
public function sampleMethod(Web $web)
{
// ...
return $web->success("Action was successful");
}
}
// ...
use YoungMayor\AppResponse\Auto;
// ...
class SampleController extends Controller
{
public function sampleMethod(Auto $auto)
{
// ...
return $auto->success("Action was successful");
}
}
// ...
use YoungMayor\AppResponse\Facade\AppResponse;
// or
use AppReponse; // this utilises the Facade aliase
// ...
class SampleController extends Controller
{
public function sampleMethod()
{
// ...
return AppResponse::success("Action was successful");
}
}
class SampleController extends Controller
{
public function sampleMethod()
{
// ...
return appResponse()->success("Action was successful"); // for automatic response
// or
return appResponse()->api->success("Action was successful"); // for API only resppnse
// or
return appResponse()->web->success("Action was successful"); // for Web only resppnse
}
}
sh
php artisan vendor:publish --provider="YoungMayor\AppResponse\AppResponseServiceProvider"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.