On this page, you will find more information about the libSQL PHP classes and available functions.
LibSQL
class provides an interface for connecting to and interacting with a LibSQL database. It supports operations such as preparing and executing SQL statements, managing transactions, and retrieving query results.
OPEN_READONLY
: Specifies read-only mode when opening the database connection.OPEN_READWRITE
: Specifies read-write mode when opening the database connection.OPEN_CREATE
: Specifies create mode when opening the database connection.LIBSQL_ASSOC
: Return results as an associative array.LIBSQL_NUM
: Return results as a numerical array.LIBSQL_BOTH
: Return results as both associative and numerical arrays.LIBSQL_ALL
: Return all result sets.LIBSQL_LAZY
: Return a result generator.$mode
: (string)__construct
LibSQL
class to establish a connection to the database.
string|array $config
: Configuration for the database connection.
int|null $flags
(optional): Connection flags (default: 6
- read-write and create mode).string|null $encryption_key
(optional): The encryption key for the database.version
(static)changes
isAutocommit
true
if autocommit is enabled, otherwise false
.totalChanges
lastInsertedId
execute
string $stmt
: The SQL statement to execute.array $parameters
(optional): Parameters for the SQL statement.executeBatch
string $stmt
: The batch of SQL statements to execute.true
if the batch execution was successful, otherwise false
.query
string $stmt
: The SQL query to execute.array $parameters
(optional): Parameters for the query.transaction
string $behavior
(optional): Transaction behavior (default: "DEFERRED"
).prepare
string $sql
: The SQL statement to prepare.close
sync
enableLoadExtension
bool $onoff
: true
to enable extensions, false
to disable.loadExtensions
array|string $extension_paths
: Paths to the extensions to load.