toniette/xlr8

a simple package to demonstrate my skills

Maintainers

Details

github.com/toniette/xlr8

Source

Issues

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/toniette/xlr8

dev-master 2023-10-24 14:10 UTC

This package is auto-updated.

Last update: 2025-10-24 18:22:12 UTC


README

<?php

use Xlr8\Sortable;
use Xlr8\Search;

require_once __DIR__ . '/vendor/autoload.php';

Search::setSources([
    'https://xlr8-interview-files.s3.eu-west-2.amazonaws.com/source_1.json',
    'https://xlr8-interview-files.s3.eu-west-2.amazonaws.com/source_2.json'
]);

$orderedHotels = Search::getNearbyHotels(-23.6814347,-46.9249416, Sortable::PRICE_PER_NIGHT);

foreach ($orderedHotels as $hotel) {
    echo sprintf(
        '%s, %s KM, %s EUR',
        $hotel['name'],
        round($hotel['proximity'], 2),
        $hotel['price_per_night']
    ) . PHP_EOL;
}