PHP code example of domos / schema

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

    

domos / schema example snippets


$estate = new Estate(
    id: '123',
    slug: 'sample-estate',
    name: 'Sample Estate',
    address: new Address(
        street: 'Main St',
        number: '123',
        postal_code: '12345',
        city: 'Sample City',
        country: 'US'
    )
);
$arrayRepresentation = $estate->toArray();

$building = new Building(
    id: 'B1',
    name: 'Building 1',
    area: 1000.0,
    media: new Media()
);
$arrayRepresentation = $building->toArray();

$rentable = new Rentable(
    id: 'R1',
    name: 'Office Space 1',
    area: 100.0,
    transaction_type: TransactionType::Rent,
    price: new Price(
        base: new Money(1000.0, Currency::Euro)
    )
);
$arrayRepresentation = $rentable->toArray();

$address = new Address(
    street: 'Main St',
    number: '123',
    postal_code: '12345',
    city: 'Sample City',
    country: 'US'
);
$arrayRepresentation = $address->toArray();

$coordinates = new Coordinates(
    latitude: 40.7128,
    longitude: -74.0060
);
$arrayRepresentation = $coordinates->toArray();

$location = new Location();
$location->places[] = new Place(
    type: Place\Type::from('restaurant'),
    name: 'Sample Restaurant',
    coordinates: new Coordinates(40.7128, -74.0060)
);
$arrayRepresentation = $location->toArray();

$image = new Image();
$image->src = 'https://example.com/image.jpg';
$image->alt = 'Sample Image';
$arrayRepresentation = $image->toArray();

$media = new Media();
$media->thumbnail = new Image();
$media->thumbnail->src = 'https://example.com/thumbnail.jpg';
$arrayRepresentation = $media->toArray();

$video = new Video(
    type: Video\Type::Embed,
    thumbnail_url: 'https://example.com/video_thumbnail.jpg'
);
$arrayRepresentation = $video->toArray();

$scan = new Scan(
    type: Scan\Type::Embed,
    provider: 'Matterport'
);
$arrayRepresentation = $scan->toArray();

$cameraFeed = new CameraFeed(
    type: CameraFeed\Type::Embed,
    provider: 'Sample Provider'
);
$arrayRepresentation = $cameraFeed->toArray();

$money = new Money(
    amount: 1000.0,
    currency: Currency::Euro
);
$arrayRepresentation = $money->toArray();

$price = new Price(
    base: new Money(1000.0, Currency::Euro),
    extra_costs: new Money(100.0, Currency::Euro)
);
$arrayRepresentation = $price->toArray();

$webExpose = new WebExpose();
$webExpose->sidebar_features = ['feature1', 'feature2'];
$webExpose->blocks[] = new TextBlock('Sample text content');
$arrayRepresentation = $webExpose->toArray();

$block = new TextBlock(
    text: 'Sample text content',
    id: 'block1'
);
$arrayRepresentation = $block->toArray();

$contact = new Contact(
    name: 'John Doe',
    email: '[email protected]',
    phone: '+1234567890'
);
$arrayRepresentation = $contact->toArray();

$certifications = new Certifications();
$certifications->dgnb = DGNBCertification::Gold;
$certifications->co2_neutral = true;
$arrayRepresentation = $certifications->toArray();