eurolink/property-api-php-client

Eurolink 属性 API 的 PHP 库

v5.0.2 2022-07-12 11:37 UTC

README

这是 Eurolink 属性 API 的 PHP 客户端。此库仅限已批准的客户端使用,这些客户端被允许访问属性 API。

请将任何支持咨询发送至 Eurolink 客户支持台 或发送电子邮件至 support@eurolink.co。

API 文档在线: https://property-api.readme.io/

安装

要安装此包,您需要使用 Composer,并且熟悉使用 PHP 命名空间。运行以下命令将 PHP 包拉入项目的 'vendor' 文件夹。

composer require eurolink/property-api-php-client

使用方法

获取属性

<?php
    require 'vendor/autoload.php';

    use PropertyAPI\Client;

    $client = new Client([
        'accessToken' => '~~INSERT_ACCESS_TOKEN~~',
    ]);

    // additional GET parameters can be passed in (see full documentation for details)
    $collection = $client->getProperties([
        'size' => 5,
    ]);

    // returns total number of properties matching search criteria
    var_dump($collection->getTotal());

    // returns number of properties returned in this collection
    var_dump($collection->getCount());

    // returns array of objects
    var_dump($collection->getRows());

    // returns array of '\PropertyAPI\Property'
    var_dump($collection->getParsedRows());
?>

获取特定属性

<?php
    require 'vendor/autoload.php';

    use PropertyAPI\Client;

    $client = new Client([
        'accessToken' => '~~INSERT_ACCESS_TOKEN~~',
    ]);

    // gets property by property ID
    $property = $client->getProperty(123456);

    // verify that property have successfully been returned
    var_dump($property->isValid());

    // test request by displaying Property ID (UUID)
    var_dump($property->getPropertyID());
?>

集合方法

以下方法在 \PropertyAPI\Client 实例上可用。

getTotal() - 返回匹配搜索条件的属性总数。

getCount() - 返回响应中的属性数量。

getRows() - 获取属性的原始数组。

getParsedRows() - 获取属性数组,作为 \PropertyAPI\Property 类的实例。

getRawResponse() - 获取原始 JSON 响应。 用于调试。

属性类方法

以下方法在 \PropertyAPI\Property 实例上可用。

getCompanyID() - 返回公司 UUID。

getPropertyID() - 返回属性 UUID。

getID() - 返回唯一的、数字属性 ID。

getWebStatus() - 返回属性的在线营销状态/可用性。

getBrochures() - 返回宣传册数组。

getFeatures() - 返回特性数组。

getAddress() - 返回地址行数组。

getAddressString() - 返回以逗号分隔的地址字符串。

getShortAddress() - 返回广告用的短地址属性标题。

getEPCImages() - 返回 EPC 图片数组。

getEPCDocuments() - 返回 EPC 文档数组。

getFeesDescription() - 返回费用。

getFeesURL() - 返回费用信息 URL。

getTenure() - 返回租期信息。

getTenureType() - 返回租期类型。

getFloorPlans() - 返回楼层平面图数组。

getCategory() - 返回类别(销售或租赁)。

isLettings() - 如果类别是租赁,则返回 true。

isSales() - 如果类别是销售,则返回 true。

getDescription() - 返回属性描述。

getCharge() - 返回服务费。

isFeatured() - 如果属性被标记为特色,则返回 true。

getFeaturedDate() - 返回属性被标记为特色的时间。

getUpdatedDate() - 返回属性数据最后更新日期。

getCriteriaType() - 返回属性类型的分类。

getAmount() - 返回属性价格。

getAvailableFromDate() - 返回属性可用日期。

getTown() - 返回城镇。

getArea() - 返回区域。

getSummaryDescription() - 返回摘要描述。

getRentPeriod() - 返回租期(例如:每周)。

getPropertyType() - 返回属性类型。

getClassification() - 返回分类。

isCommerical() - 如果是商业地产则返回 true。

getOutsideSpace() - 返回关于外部空间的信息。

getParking() - 返回关于停车的信息。

getFloors() - 返回楼层数。

getBedrooms() - 返回卧室数量。

getBathrooms() - 返回卫生间数量。

getFurnished() - 返回装修状态。

getSellingState() - 返回销售状态。

getMarketingDescription() - 返回营销描述。

getMarketingDescriptionHTML() - 返回包含 HTML 的营销描述。

getNewProperty() - 如果地产是新地产则返回 Y/N。

getKeywords() - 返回关键词。

getGroundRent() - 返回地租费用。

getNewHome() - 如果地产是新住宅则返回 true。

getInsertDate() - 返回首次添加地产的日期。

getURLs() - 返回 URL 数组。

getOfficeID() - 返回关联办公室的 UUID。

getOfficeName() - 返回关联办公室的名称。

getOfficePhone() - 返回关联办公室的电话号码。

getOfficeEmail() - 返回关联办公室的电子邮件。

getOfficeManager() - 返回关联办公室经理的姓名。

getOfficeURL() - 返回关联办公室的网站 URL。

getPhotos() - 返回照片数组。

getPostcode() - 返回邮政编码。

getLocation() - 返回经纬度数组。

getLongitude() - 返回经度。

getLatitude() - 返回纬度。

getVideoURLs() - 返回视频 URL 数组。

其他数据可以通过使用魔法方法获取。例如

$property->URLs->URL2

测试此包

单元测试

将您的 API 访问令牌粘贴到根目录下的 .env 文件中。请参阅 .env.example

./vendor/bin/phpunit tests/

视觉测试

将您的 API 访问令牌粘贴到根目录下的 .env 文件中。请参阅 .env.example

php example/simple.php
// or
php example/complex.php