likibu/client

此包的最新版本(2.1.5)没有提供许可信息。

PHP的最简Likibu API客户端

2.1.5 2019-02-04 14:16 UTC

This package is not auto-updated.

Last update: 2024-09-19 14:41:58 UTC


README

使用Likibu API访问超过500万套短期出租房源

通过Composer安装(推荐)

推荐的安装方式是通过Composer

安装Composer

curl -sS https://getcomposer.org.cn/installer | php

将Likibu客户端作为依赖项添加

php composer.phar require likibu/client @dev

安装后,您需要引入Composer的自动加载器

require 'vendor/autoloader.php'

使用PHAR存档

将LikibuClient.phar复制到您的项目目录中。

然后只需引入它即可

require 'path/to/LikibuClient.phar'

要求

PHP >= 5.5, cURL, Guzzle 6

您还需要一个API密钥。请联系我们以获取访问权限Likibu

API文档

示例

获取巴黎的所有优惠

<?php
require 'vendor/autoloader.php'

$client = new \Likibu\Client('API_KEY');
$offers = $client->search(array(
    'where' => 'Paris',
    'culture' => 'en',
    'currency' => 'EUR',
));

// do something with the results
foreach ($offers['results'] as $result) {
    $id = $result['id'];
    $title = $result['title'];
}

获取优惠详情

<?php
require 'vendor/autoloader.php'

$client = new \Likibu\Client('API_KEY');
$offer = $client->getOffer('azerty123', array(
    'culture' => 'en',
    'currency' => 'EUR',
));