Download the PHP package er-dhruvmishra/laravel-sqlite-ffi without Composer

On this page you can find all versions of the php package er-dhruvmishra/laravel-sqlite-ffi. 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 laravel-sqlite-ffi

Laravel SQLite FFI

A drop-in replacement for Laravel's SQLite database driver with a 3-tier fallback chain. Works even when pdo_sqlite and FFI are both unavailable.

Zero code changes needed — install via Composer and your existing 'driver' => 'sqlite' configuration works immediately.

Why?

Some hosting environments or custom PHP builds don't include the pdo_sqlite extension. This package provides the same SQLite functionality through multiple backends:

Tier Backend Speed Requires
1 Native pdo_sqlite Fastest PHP extension
2 FFI (libsqlite3) Near-native ext-ffi + ffi.enable=true
3 sqlite3 CLI binary Slower (IPC) Binary on system or auto-downloaded

The package auto-detects the best available backend. The CLI tier auto-downloads sqlite3 from sqlite.org on first use if not found on the system.

Requirements

Requirement Details
PHP >= 8.1
Laravel 10.x / 11.x / 12.x
At least one of:
pdo_sqlite PHP extension (Tier 1, best performance)
ext-ffi + libsqlite3 FFI extension with ffi.enable=true (Tier 2)
sqlite3 binary System binary or auto-downloaded (Tier 3)

Installation

1. Install the package

Laravel auto-discovers the service provider. No manual registration needed.

2. Use it

No changes to your code or config. The standard Laravel SQLite configuration works as-is:

The package automatically picks the best available backend.

3. Optional: Enable specific backends

For FFI (Tier 2):

For CLI (Tier 3):

How It Works

Backend Priority Configuration

By default, the fallback order is: native → ffi → cli

You can customize this in three ways:

Force a specific backend

In config/database.php:

Or via environment variable:

Custom fallback order

In config/database.php:

Or via environment variable:

Set default priority in code

Check which backend is active

TNTSearch Compatibility

If you use teamtnt/tntsearch, it calls new PDO('sqlite:...') directly which fails without pdo_sqlite. This package includes a drop-in engine replacement:

The TntSearchEngine uses the same 3-tier fallback as the main driver.

Configuration Options

All standard Laravel SQLite config options are supported, plus:

Environment variables

Variable Description Example
SQLITE_BACKEND Force a specific backend ffi
SQLITE_PRIORITY Custom fallback order (comma-separated) cli,ffi,native
SQLITE_FFI_LIBRARY_PATH Custom path to libsqlite3.so /opt/lib/libsqlite3.so
SQLITE3_BINARY_PATH Custom path to sqlite3 binary /opt/bin/sqlite3

Supported Features

Compatibility

Feature Native FFI CLI
DB::connection('sqlite') Yes Yes Yes
Schema::create() / drop() Yes Yes Yes
Query Builder CRUD Yes Yes Yes
Eloquent models Yes Yes Yes
Transactions + rollback Yes Yes Yes
php artisan migrate Yes Yes Yes
Multiple connections Yes Yes Yes
In-memory (:memory:) Yes Yes Yes
lastInsertId() Yes Yes Yes
Server-side prepared statements Yes Yes No*
TNTSearch indexing Yes Yes Yes

* CLI tier uses client-side parameter escaping (safe, but slightly different execution model).

Troubleshooting

"No SQLite backend available"

At least one backend must be available. Check:

"FFI API is restricted by ffi.enable"

FFI is loaded but ffi.enable is set to preload (default) instead of true:

Restart PHP-FPM after changing:

"libsqlite3 shared library not found"

Install the SQLite3 library:

"sqlite3 binary not found"

For CLI tier, install sqlite3 or let the package auto-download it:

The package will also auto-download from sqlite.org on first use if the bin/ directory is writable.

License

MIT License. See LICENSE for details.


All versions of laravel-sqlite-ffi with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
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 er-dhruvmishra/laravel-sqlite-ffi contains the following files

Loading the files please wait ...