tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
8.68k stars 230 forks source link

PHP language bindings #610

Open penberg opened 8 months ago

penberg commented 8 months ago

Let's add support for PHP.

BrandonDR commented 7 months ago

I would like to see Laravel & PHP support. Here is my feature request for the Laravel Framework https://github.com/laravel/framework/discussions/49340

darkterminal commented 1 month ago

Hello Punk!

I build bunch of Turso/LibSQL Client for fun experiment and I love it! I am also build:


The Final

I'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 :smile:). 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 :tada: :rocket:

NOTE This party only for Linux & Mac/Darwin. But Windows can join when using WSL :smile:

Another Options

I am also create native extension LibSQL Extension, so you can download and install them and configured in php.ini but still, it's not based on PDO driver.

Recent Updates

Make sure you follow the latest update from My X Thread!

22 Mei 2024 - LibSQL Driver Laravel - Initial I created LibSQL Driver Laravel still work in progress. It's will used Illuminate\Support\Facades\DB to interact with LibSQL native driver.
23 Mei 2024 - LibSQL Driver Laravel - LibSQL Local Connection And now LibSQL Driver Laravel can perform database operations using traditional Illuminate\Support\Facades\DB for LibSQL Local Connection: - Migration and Seeding - CRUD - Transaction
23 Mei 2024 - LibSQL Driver Laravel - LibSQL Remote Replica Connection And now LibSQL Driver Laravel can perform database sync operations using traditional Illuminate\Support\Facades\DB for LibSQL Remote Replica Connection: - Migration and Seeding - CRUD - Transaction - Sync Here the screenshot of fresh Laravel app database migration and data: 1. **Local `database.sqlite` tables** ![Local `database.sqlite` tables](https://github.com/laravel/framework/assets/32319439/2836c371-7e99-47a6-9e62-f496a236dad9) 2. **Remote database tables at Turso Dashboard** ![Remote database tables at Turso Dashboard](https://github.com/laravel/framework/assets/32319439/3869bac5-8351-4f52-accb-172a00e09fdf) 3. **Users Data from Seeder Database at Turso Dashboard** ![Users Data from Seeder Database at Turso Dashboard](https://github.com/laravel/framework/assets/32319439/0976c9d6-1dea-4fe0-a5ae-cf697f278ae2) 5. **Users Data From in Local `database.sqlite` File** ![Users Data From in Local `database.sqlite` File](https://github.com/laravel/framework/assets/32319439/14aef558-beb0-4ecb-bcea-a9ace529ed62)

LibSQL Drive Laravel - Out Now!!!

LibSQL Drive Laravel

Tweet: https://x.com/panggilmeiam/status/1793857451969896480