PHPackages                             lustmored/lockme-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. lustmored/lockme-sdk

ActiveLibrary

lustmored/lockme-sdk
====================

LockMe SDK

2.5.2(1mo ago)116.2k↓50%1GPL-3.0-or-laterPHPPHP &gt;=8.2.0

Since Nov 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/lockmepl/lockme-sdk)[ Packagist](https://packagist.org/packages/lustmored/lockme-sdk)[ RSS](/packages/lustmored-lockme-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (32)Used By (0)

LockMe SDK
==========

[](#lockme-sdk)

PHP SDK for interacting with the LockMe API. This library provides a simple interface for authentication and making API calls to the LockMe platform.

For comprehensive API documentation, please visit .

Requirements
------------

[](#requirements)

- PHP 7.2 or higher
- ext-json
- Composer

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require lustmored/lockme-sdk
```

Configuration
-------------

[](#configuration)

To use the SDK, you need to create an instance with your client credentials:

```
use Lockme\SDK\Lockme;

$sdk = new Lockme([
    "clientId" => 'YOUR_CLIENT_ID',
    "clientSecret" => "YOUR_CLIENT_SECRET",
    "redirectUri" => 'YOUR_REDIRECT_URI',
    // Optional: Custom API domain (defaults to https://api.lock.me)
    "apiDomain" => 'https://api.lock.me'
]);
```

Authentication
--------------

[](#authentication)

The SDK uses OAuth2 for authentication. Here's how to implement the authentication flow:

### Step 1: Get Authorization URL

[](#step-1-get-authorization-url)

```
// Define the scopes you need - rooms_manage is required for booking operations
$authUrl = $sdk->getAuthorizationUrl(['rooms_manage']);

// Redirect the user to the authorization URL
header('Location: ' . $authUrl);
exit;
```

### Step 2: Handle the Callback

[](#step-2-handle-the-callback)

```
// In your callback URL handler
$code = $_GET['code'];
$state = $_GET['state'];

try {
    // Exchange the authorization code for an access token
    $accessToken = $sdk->getTokenForCode($code, $state);

    // Save the token for future use
    file_put_contents('token.json', json_encode($accessToken));
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
```

### Step 3: Use the Saved Token

[](#step-3-use-the-saved-token)

```
try {
    // Load the token from storage and set up automatic saving when refreshed
    $sdk->loadAccessToken(
        fn() => file_get_contents('token.json'),
        fn($token) => file_put_contents('token.json', json_encode($token))
    );

    // Now you can make API calls
    $rooms = $sdk->RoomList();
} catch(Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
```

API Usage Examples
------------------

[](#api-usage-examples)

### Test Connection

[](#test-connection)

```
$result = $sdk->Test();
```

### Get Room List

[](#get-room-list)

```
$rooms = $sdk->RoomList();
```

### Get Bookings for a Room

[](#get-bookings-for-a-room)

```
use DateTime;

$roomId = 123;
$date = new DateTime();
$reservations = $sdk->GetReservations($roomId, $date);
```

### Add a Booking

[](#add-a-booking)

```
$data = [
    'date' => '2023-01-01',          // Date in YYYY-MM-DD format
    'hour' => '11:00:00',            // Time in HH:MM:SS format
    'roomid' => 123,                 // Room ID
    'extid' => 'abc123',             // External ID (your system's ID)
    'name' => 'John',                // Customer's first name
    'surname' => 'Doe',              // Customer's last name
    'email' => 'john.doe@example.com', // Customer's email
    'phone' => '+1234567890',        // Customer's phone number
    'people' => 4,                   // Number of people
    'pricer' => 1,                   // Pricer ID (pricing option)
    'comment' => 'Special requests', // Booking comment
    'price' => 100.00,               // Price
];

$reservationId = $sdk->AddReservation($data);
```

### Get Booking Details

[](#get-booking-details)

```
$roomId = 123;
$reservationId = 'abc123';
$reservation = $sdk->Reservation($roomId, $reservationId);
```

> **Note:** Whenever a booking ID is used, you can also use an external ID (the one set via API) by using the format "ext/{id}". For example: `$reservationId = 'ext/abc123';`

### Edit a Booking

[](#edit-a-booking)

```
$roomId = 123;
$reservationId = 'abc123';
$data = [
    'name' => 'John',               // Customer's first name
    'surname' => 'Doe',             // Customer's last name
    'email' => 'john.doe@example.com', // Customer's email
    'phone' => '+1234567890',       // Customer's phone number
    'people' => 4,                  // Number of people
    'pricer' => 1,                  // Pricer ID (pricing option)
    'comment' => 'Updated requests', // Booking comment
    'price' => 100.00,              // Price
];

$result = $sdk->EditReservation($roomId, $reservationId, $data);
```

### Delete a Booking

[](#delete-a-booking)

```
$roomId = 123;
$reservationId = 'abc123';
$result = $sdk->DeleteReservation($roomId, $reservationId);
```

### Get Date Settings

[](#get-date-settings)

```
$roomId = 123;
$date = new DateTime();
$settings = $sdk->GetDateSettings($roomId, $date);
```

### Set Date Settings

[](#set-date-settings)

```
$roomId = 123;
$date = new DateTime();
$settings = [                  // Specific hour settings
    [
        "hour" => "16:00:00",   // Time slot
        "pricers" => [1227],    // Available pricing options for this slot
    ],
    [
        "hour" => "18:00:00",
        "pricers" => [1227, 1228],
    ]
];

$result = $sdk->SetDateSettings($roomId, $date, $settings);
```

Available Methods
-----------------

[](#available-methods)

- `getAuthorizationUrl(array $scopes)`: Get the authorization URL for OAuth2 flow
- `getTokenForCode(string $code, string $state)`: Exchange authorization code for access token
- `refreshToken(?AccessToken $accessToken)`: Refresh an access token
- `setDefaultAccessToken($token)`: Set the default access token for API calls
- `loadAccessToken(callable $load, ?callable $save)`: Load and optionally set up saving of access token
- `Test()`: Test the API connection
- `RoomList()`: Get list of rooms
- `Reservation(int $roomId, string $id)`: Get booking details
- `AddReservation(array $data)`: Create a new booking
- `DeleteReservation(int $roomId, string $id)`: Delete a booking
- `EditReservation(int $roomId, string $id, array $data)`: Edit a booking
- `MoveReservation(int $roomId, string $id, array $data)`: Move a booking
- `GetReservations(int $roomId, DateTime $date)`: Get bookings for a room on a specific date
- `GetMessage(int $messageId)`: Get a message
- `MarkMessageRead(int $messageId)`: Mark a message as read
- `GetDateSettings(int $roomId, DateTime $date)`: Get settings for a specific date
- `SetDateSettings(int $roomId, DateTime $date, array $settings)`: Set settings for a specific date
- `RemoveDateSettings(int $roomId, DateTime $date)`: Remove custom settings for a specific date
- `GetDaySettings(int $roomId, int $day)`: Get settings for a specific day of the week
- `SetDaySettings(int $roomId, int $day, array $settings)`: Set settings for a specific day of the week

License
-------

[](#license)

This package is licensed under the GPL-3.0-or-later License - see the [LICENSE](LICENSE) file for details.

Author
------

[](#author)

- Jakub Caban ()

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~101 days

Total

31

Last Release

57d ago

Major Versions

1.1.1 → 2.0.02020-09-29

PHP version history (4 changes)1.0.1PHP &gt;=5.5.0

2.0.0PHP &gt;=7.2.0

2.3.2PHP &gt;=8.1.0

2.4.0PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/426c03afba39369e2dba2d3c2713c0831f26f02c405b8cfa23f0bf41b9ec2a91?d=identicon)[Lustmored](/maintainers/Lustmored)

---

Top Contributors

[![Lustmored](https://avatars.githubusercontent.com/u/2358046?v=4)](https://github.com/Lustmored "Lustmored (26 commits)")

### Embed Badge

![Health badge](/badges/lustmored-lockme-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/lustmored-lockme-sdk/health.svg)](https://phpackages.com/packages/lustmored-lockme-sdk)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[crunzphp/crunz

Schedule your tasks right from the code.

2292.0M6](/packages/crunzphp-crunz)[jolicode/automapper

JoliCode AutoMapper

213439.4k7](/packages/jolicode-automapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
