Configuration
To create remote connection you need to prepare your Turso/LibSQL DatabaseDATABASE_URL and DATABASE_AUTH_TOKEN.
If you already have Turso/LibSQL Database account, do following this commands:
Get the database URL:
.env or somewhere else.
- 500 Databases
- 9GB of total storage
- 1 billion row reads
- Unlimited Embedded Replicas
-
Standard DSN Connection with
libsql://: -
Standard DSN Connection with
https://:
libsql:// or https:// protocol in the DSN string. The format is:
Refference: See detail Remote Connection Configuration
Connect with libsql:// Protocol
-
Usage Explanation:
- This option employs the
libsql://protocol in the DSN string to connect to the remote database. - The DSN string specifies the database name as
libsql://database-org.turso.io. - Additionally, it requires an authentication token (
authToken) for secure access, provided asrandom-token.
- This option employs the
-
Steps to Use:
- Replace
"libsql://database-org.turso.io"with the actual database name or path you intend to connect to. - Ensure you have the correct authentication token (
authToken) for accessing the database securely. - Use this connection object (
$db) to interact with the specified remote database in your PHP application.
- Replace
Connect with https:// Protocol
-
Usage Explanation:
- Similar to Option 1, this option utilizes a DSN string with the
https://protocol to establish a connection. - The DSN string specifies the database name or path as
https://database-org.turso.io. - It also requires an authentication token (
authToken) provided asrandom-tokenfor secure access.
- Similar to Option 1, this option utilizes a DSN string with the
-
Steps to Use:
- Replace
"https://database-org.turso.io"with the actual database name or path you wish to connect to. - Ensure you have the correct authentication token (
authToken) for accessing the database securely. - Utilize the created connection object (
$db) to interact with the designated remote database within your PHP application.
- Replace
libsql:// or https:// protocols with the LibSQL PHP Extension. Ensure accurate configuration of the DSN string and authentication token for successful connection establishment and secure data access.

