Replies: 8 comments 4 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.
-
Hello Punk! I build bunch of Turso/LibSQL Client for fun experiment and I love it! I am also build:
The FinalI've done building a Native LibSQL Extension/Driver/Whatever and I am try to package this driver into Laravel (but I need some help here 😄). Since this is not an official PHP extension, I need to make it installable in the project. What I've Done?This weekend May, 19 2024, I am done and re-think about what I am talking before. I just drunk stupid person but still; I am handsome. The LibSQL PHP Ext can be use stand-alone, this is the core dependency of LibSQL Client PHP. Requirements
🚨 DON'T WORRY ABOUT REQUIREMENTS 🚨Everything will be prepared when you install this extension. But, if you encountered an error; create an issue. So with LibSQL PHP Ext features we can create custom LibSQL Driver for Laravel (but it's not support remote), remote connection still handle via HTTP SDK from LibSQL Client PHP. So let me know, who want to join the party 🎉 🚀
Another OptionsI am also create native extension LibSQL Extension, so you can download and install them and configured in Recent UpdatesMake sure you follow the latest update from My X Thread! 22 Mei 2024 - LibSQL Driver Laravel - InitialI created LibSQL Driver Laravel still work in progress. It's will usedIlluminate\Support\Facades\DB to interact with LibSQL native driver.
23 Mei 2024 - LibSQL Driver Laravel - LibSQL Local ConnectionAnd now LibSQL Driver Laravel can perform database operations using traditionalIlluminate\Support\Facades\DB for LibSQL Local Connection:
23 Mei 2024 - LibSQL Driver Laravel - LibSQL Remote Replica ConnectionAnd now LibSQL Driver Laravel can perform databasesync operations using traditional Illuminate\Support\Facades\DB for LibSQL Remote Replica Connection:
Here the screenshot of fresh Laravel app database migration and data:
LibSQL Drive Laravel - Out Now!!!
|
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