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
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-11-09