承接 klevio/klevio-api 相关项目开发

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

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

klevio/klevio-api

最新稳定版本:1.0.0

Composer 安装命令:

composer require klevio/klevio-api

包简介

Laravel package for integrating with the Klevio API

README 文档

README

Latest Version on Packagist Total Downloads License

A powerful Laravel package for seamless integration with Klevio's smart access control system. Manage digital keys, access rights, and smart locks with enterprise-grade security.

DocumentationInstallationUsage ExamplesContributing

✨ Features

  • 🔒 Secure Authentication - JWT-based API authentication
  • 🔑 Key Management - Grant and revoke access rights
  • 🏢 Property Control - Manage multiple properties
  • 📱 Smart Lock Integration - Remote lock/unlock capabilities
  • 🔄 Real-time Operations - Instant access management
  • 🛡️ Enterprise Security - ES256 encryption

📚 Documentation

Comprehensive documentation is available:

🚀 Quick Start

Installation

composer require klevio/klevio-api

Getting Started

1️⃣ Sign Up for API Access

2️⃣ Generate Security Keys

# Generate ES256 Private Key
openssl ecparam -genkey -name secp256k1 -out private_key.pem

# Extract Public Key
openssl ec -in private_key.pem -pubout -out public_key.pem

3️⃣ Configure Environment

Add to your .env file:

KLEVIO_CLIENT_ID="your_client_id"
KLEVIO_API_KEY="your_api_key"
KLEVIO_API_URL="https://api.klevio.com/v2"

# Keys should be properly formatted with escaped newlines
KLEVIO_PRIVATE_KEY="-----BEGIN EC PRIVATE KEY-----\nMIGHAgEA...\n-----END EC PRIVATE KEY-----"
KLEVIO_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\nMFkwEwYH...\n-----END PUBLIC KEY-----"

💡 Usage Examples

Managing Access Keys

use Klevio\KlevioApi\Facades\KlevioApi;

// Grant Access with Metadata
$response = KlevioApi::grantKey(
    propertyId: 'property-123',
    email: 'guest@example.com',
    from: '2024-01-01T00:00:00Z',
    to: '2024-01-07T23:59:59Z',
    metadata: [
        'reservationId' => 'booking-123',
        'guestName' => 'John Doe',
        'roomNumber' => '101'
    ]
);

// List Property Keys
$keys = KlevioApi::getKeys('property-123');

// Control Lock
$response = KlevioApi::useKey('key-123');

Error Handling

use GuzzleHttp\Exception\RequestException;

try {
    $response = KlevioApi::useKey('key-123');
} catch (RequestException $e) {
    Log::error('Klevio API Error', [
        'message' => $e->getMessage(),
        'code' => $e->getCode()
    ]);
}

🛡️ Security Best Practices

  • Store credentials securely using environment variables
  • Never commit sensitive keys to version control
  • Regularly rotate API keys
  • Monitor API access logs
  • Use HTTPS for all API communications

🧪 Testing

composer test

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📝 License

The MIT License (MIT). Please see License File for more information.

🔗 Links

Made with ❤️ by Mehedi Hasan Sagor

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-28