1. Go to this page and download the library: Download vitisstudio/restdb-jsonapi 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/ */
vitisstudio / restdb-jsonapi example snippets
'crm' => [
'driver' => 'restdb',
'adapter' => 'json-api',
'base_url' => env('CRM_API_URL'),
'pagination' => ['strategy' => 'page-number', 'size' => 50, 'meta_total' => 'meta.page.total'],
'filter_dialect' => 'nested-operator', // or 'comma-list', or your FilterDialect class
'name_mapping' => 'camel', // or 'kebab', 'none'
],
class Article extends Model
{
use \Vitis\RestDB\JsonApi\IsJsonApiResource;
protected $connection = 'crm';
protected $table = 'articles';
}
bash
php artisan restdb:make-models crm --spec=storage/api-specs/crm.json \
--path=app/Models/Crm --namespace="App\Models\Crm"
php artisan restdb:discover crm --spec=storage/api-specs/crm.json # + --check in CI
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.