PHP code example of elsuterino / respondus

1. Go to this page and download the library: Download elsuterino/respondus 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/ */

    

elsuterino / respondus example snippets


use Barklis\Respondus\Options;
use Barklis\Respondus\Respondus;

class UserResource extends Respondus
{
    public function makeFromModel(User $user): self
    {
        $this->id = $user->id;
        $this->email = $user->email;
        // Additional fields...
        return $this;
    }
    // Other class methods...
}

$resource = (new UserResource)->makeFromModel($user)->setHidden(UserResource::class, 'email')->toArray();