定制 degordian/roomfinder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

degordian/roomfinder

Composer 安装命令:

composer require degordian/roomfinder

包简介

Finding available meeting rooms, and reserving them

README 文档

README


A php wrapper around something that can handle rooms and their availability(google calendar for instance)

How to install (Composer)

composer require degordian/roomfinder

or add to your project's composer.json

"require": {
    "degordian/roomfinder": "*"
}

How to use

First you have to atuthenticate yourself for using google calendar for instance
A google calendar example is in examples/auth
You can add new adapters for room resourcing, currently only Google Calendar is supported

Create a google app here:
https://console.developers.google.com/apis/credentials/oauthclient
Export the client_secret.json file
Save it to disk, and paste the path to the file into $clientSecretPath
For $credentialsPath, use the location on your disk where you want the auth.php script to create your auth file
Through the command line, call

   php examples/auth.php

This will serve you a google link to authenticate yourself and create a credential file you can then use in your project

Using that file you can now you can initialize an adapter for those rooms

$roomResourceAdapter = new RoomResourceGoogleCalendar();
$roomResourceAdapter->setConfig([
    'applicationName' => 'FindARoom',
    'credentialsPath' => '/Users/tonymrakovcic/credentials/calendar-findaroom.json',
    'clientSecretPath' => '/Users/tonymrakovcic/credentials/client_secret.json',
    'scopes' => [\Google_Service_Calendar::CALENDAR],
    'accessType' => 'offline',
])->init();

Initialize a room handler, and register the adapter
$roomHandler = new RoomHandler();
$roomHandler->setRoomResourceAdapter($roomResourceAdapter);

Create a room from some data
$rooms  = [
    [
        'name' => 'Meeting room one',
        'id' => 'YOUR_CALENDAR_ID_1@group.calendar.google.com',
        'size' => Room::SIZE_BIG,
        'resourceClass' => RoomResourceGoogleCalendar::class,
    ],
    [
        'name' => 'Meeting room two',
        'id' => 'YOUR_CALENDAR_ID_2@group.calendar.google.com',
        'size' => Room::SIZE_MEDIUM,
        'resourceClass' => RoomResourceGoogleCalendar::class,
    ]
];

Add the rooms to the room handler
$roomHandler->addRooms($rooms);

Find the availability of all rooms
$roomsAvailable = $roomHandler->getAllRoomsAvailability();

Find an availble room, that wont be occupied in the next x minutes
$availableRoomNow = $roomHandler->findAvailableRoom(RoomHandler::HOUR);

Find an available room, that wont be occupied in the next x minutes, and filter by size
$roomsAvailable = $roomHandler->findAvailableBigRoom();

Reserve a room in the calendar

$reservation = $roomHandler->reserveRoom($roomsAvailable[0]);

Contribute

Contributions and comments are more than welcome :)

Questions, problems?

We will do our best to answer all issues

License

MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固