定制 litebase/litebase-php 二次开发

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

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

litebase/litebase-php

最新稳定版本:v0.5.7

Composer 安装命令:

composer require litebase/litebase-php

包简介

Litebase PHP SDK

README 文档

README

tests GitHub License

A PHP SDK for interacting with Litebase, an open source distributed database built on SQLite, distributed file systems, and object storage.

Installation

You can install the package via composer:

composer require litebase/litebase-php

Usage

use Litebase\Configuration;
use Litebase\LitebasePDO;

$pdo = new LitebasePDO([
    'host' => 'localhost',
    'port' => 8888,
    'token' => 'your_api_token',
    'database' => 'your_database_name/main',
]);

$statement = $pdo->prepare('SELECT * FROM users WHERE id = ?');
$statement->execute([1]);
$result = $statement->fetchAll(PDO::FETCH_ASSOC);

foreach ($result as $row) {
    print_r($row);
}

// Use transactions
$pdo = $pdo->beginTransaction();

try {
    $statement = $pdo->prepare('INSERT INTO users (name, email) VALUES (?, ?)');
    $statement->execute(['John Doe', 'john@example.com']);

    $statement = $pdo->prepare('INSERT INTO logs (user_id, action) VALUES (?, ?)');
    $statement->execute([$pdo->lastInsertId(), 'user_created']);
    
    $pdo->commit();
} catch (\Exception $e) {
    $pdo->rollBack();
    throw $e;
}

Contributing

Please see CONTRIBUTING for details.

Testing

You can run the tests:

composer test

Integration tests require a running Litebase Server. When running integration tests, a server will be automatically started using Docker. You can run the tests with:

composer test-integration

Code of Conduct

Please see CODE OF CONDUCT for details.

Security

All security related issues should be reported directly to security@litebase.com.

License

Litebase is open-sourced software licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-07