PHP code example of gzhpackages / laravel-json-api
1. Go to this page and download the library: Download gzhpackages/laravel-json-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/ */
gzhpackages / laravel-json-api example snippets
namespace App\Http\Controllers;
use GzhPackages\JsonApi\Traits\ApiHelper;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use ApiHelper;
public function show()
{
// do something...
return $this->content(['foo' => 'bar']);
}
public function create()
{
// do something...
return $this->created();
}
}