Replies: 7 comments 3 replies
-
I'm taking a crack at building a package/library for this, starting today. For the simple reason that I love Turso and Laravel, I would like to use them together. I'm quite glad I searched up this issue. Is anyone aware of ongoing efforts toward this end? @BrandonDR I was thinking, same as you, of just building an HTTP client on the Turso API, rather than a PHP extension for LibSQL, but possibly both, and offer a config option for it down the road. I don't see any reason why the http client would be terribly complex to implement, I may reach out to you with a request for contributions after I get a POC going. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/darkterminal/turso-http - this exists, I'll be be trying it out, it is listed as an Experimental SDK in the Turso docs, it appeared somewhat recently and looks pretty good. |
Beta Was this translation helpful? Give feedback.
-
i think that could be a greate adition! |
Beta Was this translation helpful? Give feedback.
-
As someone who made a custom DB driver for Eloquent (cockroachDB driver) I will say, making the driver is fairly easy but the hardest bit is grabbing the tests from the Laravel Repo. Eloquent is built on top of the PHP PDO extension. There might be some difficulty with that as I assume you'd want to implement it 100% in PHP instead of trying to write a PDO extension. Overally it wouldn't be too hard as all the Grammar is just SQLite. |
Beta Was this translation helpful? Give feedback.
-
I started messing about with it here - https://github.com/nick-potts/Laravel-LibSQL I think the best implementation method is extending the PDO and StatementPDO and using the HTTP client there. That way you keep the stock Laravel implementation of sqlite. |
Beta Was this translation helpful? Give feedback.
-
I've got it pretty close now, there's something funky that I haven't been able to figure out with transactions rolling back, but the base concept is working. Edit: transactions working now, the only last thing is binary blob storage isn't working |
Beta Was this translation helpful? Give feedback.
-
I started consuming nick-potts' libsql for Laravel implementation yesterday, was looking into the BLOB bug and updating the README, but as of today it has been archived. Check out |
Beta Was this translation helpful? Give feedback.
-
LibSQL is an open-source fork of SQLite. It powers the growing Turso platform, which provides distributed database support. Whereas, SQLite does NOT handle asynchronous operations well making SQLite unsuitable for production environments at moderate scale.
Currently, there appears to be no first-party LibSQL PHP driver. However, given it's similarities to the currently supported SQLite driver, I wonder if we can add support for LibSQL in Laravel.
LibSQL allows for the SQLite dialect of SQL over HTTP, as well as
.sqlite
file databases. Making it great for server-less deployments and for simplifying CI/CD deployment for Laravel unit/integration tests. Simply copy a prepared database file and you have a repeatable environment for testing. LibSQL appears to solve the production downsides of SQLite with its replication and asynchronous support.This all means, we can have fast integration tests that can closely replicate the production environment with same SQL dialect without running a heavy test MySQL server, for example. Which would have its own maintenance, state and deployment complexity.
LibSQL seems very promising and developer friendly.
Turso / LibSQL resources
I think the implementation would roughly be:
Thank you for your consideration. I would be interested in helping efforts towards this support.
Beta Was this translation helpful? Give feedback.
All reactions