Download the PHP package richan-fongdasen/turso-laravel without Composer

On this page you can find all versions of the php package richan-fongdasen/turso-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package turso-laravel

A Turso database driver for Laravel

Latest Version on Packagist License: MIT PHPStan Unit Tests Code Style codecov Total Downloads

This package provides a Turso database driver for Laravel, allowing you to use Turso as your database backend in Laravel applications. The driver communicates with the Turso database server using an HTTP client.

You can find a demo application that uses this Turso database driver in the richan-fongdasen/pingcrm repository.

Requirements

Installation

You can install the package via Composer:

To use Turso as your database driver in Laravel, append the following configuration to the connections array in your config/database.php file:

Publishing Configuration and Sync Script

Publish the configuration file and sync script by running the following command:

The above command publishes the following files:

The content of the config/turso-laravel.php file should look like this:

You may need to set the NODE_PATH environment variable to the path of your Node.js executable. This is required to run the sync script.

Installing Node.js Dependencies

The Turso database driver requires Node.js to run the sync script. Install the Node.js dependencies by running the following command:

Configuration

In Laravel applications, the database driver configuration is stored in your .env file. Here are the available configurations for the Turso database driver:

ENV Variable Name Description
DB_URL The Turso database server URL. E.g: https://[databaseName]-[organizationName].turso.io
DB_ACCESS_TOKEN (Optional) The access token to access the Turso database server.
DB_REPLICA (Optional) The full path to the local embedded replica database file. E.g: /tmp/turso.sqlite
DB_PREFIX (Optional) The database table prefix.
DB_FOREIGN_KEYS Enable or disable foreign key constraints, default is true.
DB_STICKY Enable or disable sticky connections while performing write operations, default is true.

Usage

For local development, you can use the local Turso database server provided by the Turso team. Refer to the Turso CLI documentation for instructions on running the local Turso database server.

The Turso database driver should work as expected with Laravel's Query Builder and Eloquent ORM. Here are some examples:

Embedded Replica Support

The driver supports the embedded replica feature. If you're unfamiliar with this feature, refer to the Turso embedded replica article for more information.

Running the sync script from artisan command

Run the sync script manually using the following Artisan command:

You may encounter an error if the path to the replica database does not exist. This is expected when the replica database has not been created yet.

Running the sync script programmatically

Run the sync script programmatically using the following code:

Debugging

To debug the HTTP requests and responses sent and received by the Turso database client, enable the debugging feature as follows:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of turso-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/bus Version ^11.0
illuminate/contracts Version ^11.0
illuminate/console Version ^11.0
illuminate/database Version ^11.0
illuminate/filesystem Version ^11.0
illuminate/http Version ^11.0
illuminate/queue Version ^11.0
illuminate/support Version ^11.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package richan-fongdasen/turso-laravel contains the following files

Loading the files please wait ....