承接 and48/laravel-wubook 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

and48/laravel-wubook

最新稳定版本:1.0.0

Composer 安装命令:

composer require and48/laravel-wubook

包简介

A WuBook bridge for Laravel 8.x https://wubook.net

README 文档

README

This version of Laravel Wubook was modified by Andrii Strilchuk, is based in the ilgala/laravel-wubook.

Installation

 composer require and48/laravel-wubook

Configuration

Laravel WuBook requires connection configuration.

Publish the package migrations files to your application.

php artisan vendor:publish --provider="AND48\LaravelWubook\WuBookServiceProvider" --tag="migrations"

This will create a wubook_configs table in your DB that you can modify to set your configuration (lcode and token).

Usage

WuBookManager

This is the class of most interest. It is bound to the ioc container as 'wubook' and can be accessed using the Facades\WuBook facade. In order to make a call to the Wired API, you may call these methods that refers to a specific area of the service.

  • availability()
  • prices()
  • reservations()
  • restrictions()
  • rooms()
Facades\WuBook

This facade will dynamically pass static method calls to the 'wubook' object in the ioc container which by default is the WuBookManager class.

WuBook API methods results

The fxmlrpc client always returns an associative array, that may be changed by the package in order to retrieve the resulting data from the XML/RPC function.

If an error occured during the call, a WuBookException will be thrown. If the call is successfully executed an array will be returned with this values:

// An error occurred
return [
    'has_error' => true,
    'code' => -100,
    'data' => 'A human readeable error message'
];

// Success
return [
    'has_error' => false,
    'code' => 0,
    'data' => [ /* THE XML/RPC FUNCTION RESPONSE */ ]
];
Real Examples

Here you can see an example of just how simple this package is to use:

use AND48\LaravelWubook\Facades\WuBook;
use AND48\LaravelWubook\Models\WubookConfig;

$credentials = WubookConfig::find(1)->only(['lcode', 'token']);
WuBook::rooms($credentials)->fetch_rooms();
// this example is simple, and there are far more methods available
// The result will be an associative array with this structure

[
    0 => [
        id => 123,
        name => 'room',
        shortname => 'ro',
        occupancy => 2,
        men => 2,
        children => 0,
        subroom => 0,
        // ...
    ],
    1 => [
        // ...
    ],
];

For more information on how to use the \LaravelWubook\WuBookManager class we are calling behind the scenes here, check out the Wired API doc.

Security

If you discover a security vulnerability within this package, please send an e-mail to Andrii Strilchuk at cater_pill@yahoo.com. All security vulnerabilities will be promptly addressed.

License

Laravel WuBook is licensed under The MIT License (MIT).

Tests

For running the tests you must specify environment variables LCODE and TOKEN.

For Windows:

 set LCODE=1111
 set TOKEN=your_token

For Linux:

 LCODE=1111
 TOKEN=your_token
 composer test
 composer test-f RoomTest

It is recommended to run with empty account on the wubook.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固