You need to know the additional configuration in .env file, which come from Laravel and which come from LibSQL Driver. And here is the overview of .env:

Laravel

DB_CONNECTION=libsql
DB_DATABASE=database.sqlite
  • DB_CONNECTION key is represent default database connection like libsql, sqlite, mysql, mariadb, pgsql, and sqlsrv.
  • DB_DATABASE key is represent the location of database name or in this case is database filename.

LibSQL Driver

DB_AUTH_TOKEN=<your-database-auth-token-from-turso>
DB_SYNC_URL=<your-database-url-from-turso>
DB_SYNC_INTERVAL=5
DB_READ_YOUR_WRITES=true
DB_ENCRYPTION_KEY=
DB_REMOTE_ONLY=false

Create a new Turso Database here

  • DB_AUTH_TOKEN - You can generate using turso db tokens create <database-name> command or you can visit your Turso Dashboard and select database you want to used and generate the token from there.
  • DB_SYNC_URL - This generate by Turso when you craete a new database, you can get the database URL by using this command turso db show --url <database-name>
  • DB_SYNC_INTERVAL - This variable defines the interval at which an embedded replica synchronizes with the primary database. It sets a duration for automatic synchronization of the database in the background. When configured, the embedded replica will periodically sync its local state with the state of the primary database to ensure it has the latest data. This is particularly useful for ensuring that replicas remain up-to-date with minimal manual intervention. Default is: 5 seconds.
  • DB_READ_YOUR_WRITES - This variable configures the database connection to ensure that writes made by a connection are immediately visible to subsequent read operations initiated by the same connection. This is important in distributed systems to ensure consistency from the perspective of the writing process. When enabled, after a write operation is performed, any reads that follow from the same connection will see the results of that write. This option is typically enabled by default to ensure that clients always see their latest writes.
  • DB_ENCRYPTION_KEY - This variable is defined for specifying the encryption key used in database encryption. It represents the secret key that is used to encrypt and decrypt the database content, ensuring that the data stored in the database is protected and can only be accessed by individuals who possess the correct key. This key is a critical component of encryption-at-rest strategies, where the goal is to secure data while it is stored on disk, preventing unauthorized access. Default is: empty.
  • DB_REMOTE_ONLY - This variable is define to use remote connection only, if you only want to read and write the database from remote database. Default: false.