PHPackages                             darkterminal/turso-client-http - 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. darkterminal/turso-client-http

ActiveLibrary

darkterminal/turso-client-http
==============================

The Turso Client HTTP library is a PHP wrapper for Turso HTTP Database API

v2.9.2(1y ago)5114041MITPHPPHP &gt;=8.1

Since Jan 21Pushed 1y ago2 watchersCompare

[ Source](https://github.com/darkterminal/turso-client-http)[ Packagist](https://packagist.org/packages/darkterminal/turso-client-http)[ GitHub Sponsors](https://github.com/sponsors/darkterminal)[ Fund](https://saweria.co/darkterminal)[ RSS](/packages/darkterminal-turso-client-http/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (21)Used By (1)

[![TursoHTTP](https://camo.githubusercontent.com/278c8e3c8b603559f6a3a6c1c7879183cf01a787b35a95ec5c9feb46b22f043e/68747470733a2f2f692e696d6775722e636f6d2f55526d41794b582e706e67)](https://camo.githubusercontent.com/278c8e3c8b603559f6a3a6c1c7879183cf01a787b35a95ec5c9feb46b22f043e/68747470733a2f2f692e696d6775722e636f6d2f55526d41794b582e706e67)

The `TursoHTTP` library is a PHP wrapper for Turso HTTP Database API (Only). It simplifies interaction with Turso databases using the Hrana over HTTP protocol. This library provides an object-oriented approach to build and execute SQL queries with same API Interface like PHP Native Extension [Turso Client PHP](https://github.com/tursodatabase/turso-client-php).

 [    ![Shows a black logo in light color mode and a white one in dark color mode.](https://camo.githubusercontent.com/1231973ca7d74462fee93f4c961bcd721ad05606533ba80fa84994344a26ba78/68747470733a2f2f692e696d6775722e636f6d2f764743433049342e706e67)  ](https://discord.gg/turso)

---

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

[](#requirements)

- Intention and Courage
- Instinct as a Software Freestyle Engineer
- Strong determination!
- [Turso](https://tur.so/dt) Account
- Don't forget to install [PHP](https://php.net) on your machine
- A cup of coffee and the music you hate the most
- Dancing (optional: if you are willing)

Features
--------

[](#features)

- **[libSQL Native Extension](https://github.com/tursodatabase/turso-client-php)** like API Interface
- Schema Builder
- Query Builder
- Turso Platform API
- Timezone Support

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

[](#installation)

You can install the **TursoHTTP** library using Composer:

```
composer require darkterminal/turso-client-http
```

Environment Variables
---------------------

[](#environment-variables)

Variable NameValueDescription`DB_URL` or `TURSO_URL`Your Turso database URL-`DB_TOKEN` or `TURSO_TOKEN`Your Turso database TOKEN-`DB_TIMEZONE` or `TURSO_TIMEZONE``Asia/Jakarta`See the list of timezones [here](https://www.php.net/manual/en/timezones.php)`DB_STRICT_QUERY` or `TURSO_STRICT_QUERY``true` / default: `false`Use strict query when using `explain` method in Query Builder`DB_LOG_DEBUG` or `TURSO_LOG_DEBUG``true` / default: `false`Set Query logs to save all query activities into a log file`DB_LOG_NAME` or `TURSO_LOG_NAME``libsql_debug`Set Query channel name`DB_LOG_PATH` or `TURSO_LOG_PATH``$HOME/.turso-http/logs/debug.log`Log file locationUsage Example
-------------

[](#usage-example)

```
use Darkterminal\TursoHttp\LibSQL;

require_once 'vendor/autoload.php';

$dbname     = getenv('DB_URL');
$authToken  = getenv('DB_TOKEN');
$db         = new LibSQL("dbname=$dbname&authToken=$authToken");

echo $db->version() . PHP_EOL;

$create_table =
