bookingsuedtirol/mss-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bookingsuedtirol/mss-php

最新稳定版本:v6.4.0

Composer 安装命令:

composer require bookingsuedtirol/mss-php

包简介

MSS API Client for PHP projects

README 文档

README

Packagist Version (including pre-releases)

MSS API Client for PHP projects. Only supports MSS 2.0!

Installation

PHP version requirement: 8.1 or greater.

The MSS API Client is not hard coupled to Guzzle, Buzz or any other library that sends HTTP messages. Instead, it uses the PSR-18 client abstraction. This will give you the flexibility to choose what PSR-7 implementation and HTTP client you want to use.

composer require bookingsuedtirol/mss-php kriswallsmith/buzz nyholm/psr7

Available methods

  • getHotelList
  • getSpecialList
  • getRoomList
  • getPriceList
  • getRoomAvailability
  • prepareBooking
  • getBooking
  • createInquiry
  • getUserSources
  • getLocationList
  • getMasterpackagesList
  • getThemeList
  • validateCoupon

Example

<?php
require __DIR__ . "/vendor/autoload.php";

use Crutches\Bitmask;
use MssPhp\Client;
use MssPhp\Bitmask\HotelDetails;

$client = new Client([
  "user" => "username",
  "password" => "password",
  "source" => "source",
]);

$res = $client->request(function ($req) {
  $req->header->method = "getHotelList";
  $req->request->search->id = ["11230"];
  $req->request->options->hotel_details = (new Bitmask(
    HotelDetails::BASIC_INFO | HotelDetails::COORDINATES
  ))->getBitmask();
});

$hotel = $res["result"]["hotel"][0];
$hotel["name"]; // => string(18) "Hotel Lichtenstern"
$hotel["stars"]; // => float(3)
$hotel["geolocation"]["latitude"]; // => float(46.53063158978)

Check out the examples directory for more advanced usage.

Exception handling

If the MSS returns an error response, a MssException exception is thrown.

<?php
use MssPhp\Exception;
// ...

try {
  $res = $client->request(function ($req) {
    // ...
  });
} catch (Exception\MssException $e) {
  $e->getMessage(); // => string(50) "Invalid value '2016-04-08' for parameter 'arrival'"
  $e->getCode(); // => int(32)
  $e->getResponse()->getStatusCode(); // => int(400)
}

Development

Run docker compose run --rm cli bash.

If you experience permission issues with some files in this folder, change the USER_ID and GROUP_ID values inside Dockerfile.

Automated tests

Run composer test inside the Docker container.

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-30