ut-devops/immoscout24-api-php
Composer 安装命令:
composer require ut-devops/immoscout24-api-php
包简介
PHP Client for interacting with the Immoscout24 REST API
README 文档
README
An example implementation for the immoscout24 rest api in php. This Client is not complete and only implements some methods for the export/import api, but it should be quite easy to extend.
install
composer install ut-devops/immoscout24-api-php
usage
The libary contains an abstract class that needs to be extended by an user defined class and implement 4 methods, that are needed to restore and save tokens.
example implementation
class MyAPI extends \ut_devops\ScoutAPI\ImmoScoutAPI
{
/**
* should save the request token with tokenname + secret, the token can be temporarily saved within a session
* this token is only needed during the "request an access token" phase.
*
* @param string $token
* @param string $secret
*
* @return void
*/
public function saveRequestToken($token, $secret){
$_SESSION['is24reqtoken'] = $token;
$_SESSION['is24reqsecret'] = $secret;
}
/**
* restores the temporarily saved request token.
*
* @return array with 2 elements: first element is the token name, second element is the secret
*/
public function restoreRequestToken(){
if(isset($_SESSION['is24reqtoken']) && isset($_SESSION['is24reqsecret'])){
return [
$_SESSION['is24reqtoken'],
$_SESSION['is24reqsecret']
];
}
return null;
}
/**
* saves the access token, the information should be stored persistently, for example in a database or file.
* the progress of getting an access token only needs to be done once per user.
*
* @param string $token
* @param string $secret
*
* @return void
*/
public function saveAccessToken($token, $secret){
file_put_contents('accessToken', serialize([$token, $secret]));
}
/**
* restores the saved access token.
*
* @return array with 2 elements: first element is the token name, second element is the secret
*/
public static function restoreAccessToken(){
if(file_exists('accessToken')) {
return unserialize(file_get_contents('accessToken'));
}
return null;
}
}
If you want to support multiple user, you can use $this->getUser() within the class.
example usage
$key = 'my consumer key';
$secret = 'my consumer secret';
// $api->dontUseSandbox();
$api = MyAPI::createClient($key, $secret);
if ($api->isVerified()) {
// get a list of possible contacts used in a real estate
$contactArray = $api->getContacts();
var_dump($contactArray);
} else {
// this will trigger the verifiaction with immoscout24, and will try to reconnect
// to the current url else you can also use a paramater to specify the callback url
$api->verifyApplication();
}
ut-devops/immoscout24-api-php 适用场景与选型建议
ut-devops/immoscout24-api-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 10 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ut-devops/immoscout24-api-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ut-devops/immoscout24-api-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-18