PHP code example of mennen-online / laravel-response-models

1. Go to this page and download the library: Download mennen-online/laravel-response-models 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/ */

    

mennen-online / laravel-response-models example snippets


use MennenOnline\LaravelResponseModels\Models\BaseModel;

class PersonContact extends BaseModel {
    protected array $fieldMap = [
        'roles.customer.number' => 'customer_number',
        'roles.vendor.number' => 'vendor_number',
        'person' => [
            'first_name' => 'person_first_name',
            'last_name' => 'person_last_name'
        ] 
    ];   
}

 use Illuminate\Support\Facades\Http;

$response = Http::get('https://api.lexoffice.io/v1/contacts/2a730f45-8078-3ccc-a2ed-563f18208eff');

$personContact = new PersonContact($response->object());

$personContact->version // 1

$personContact->customer_number // 12345

$personContact->__get('person.first_name') // Verena