{"id":15050559,"url":"https://github.com/darkterminal/turso-http-laravel","last_synced_at":"2025-04-10T02:14:24.858Z","repository":{"id":255446001,"uuid":"852463317","full_name":"darkterminal/turso-http-laravel","owner":"darkterminal","description":"Turso/libSQL HTTP SDK for Laravel","archived":false,"fork":false,"pushed_at":"2025-02-03T11:47:11.000Z","size":43,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T02:13:59.894Z","etag":null,"topics":["database","laravel","libsql","php","sqlite","turso"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darkterminal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"darkterminal","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":"https://saweria.co/darkterminal"}},"created_at":"2024-09-04T21:12:14.000Z","updated_at":"2025-02-20T13:15:22.000Z","dependencies_parsed_at":"2024-09-04T22:14:43.468Z","dependency_job_id":"4bd6374a-8d28-46b5-aaf0-8df6d1de1e32","html_url":"https://github.com/darkterminal/turso-http-laravel","commit_stats":null,"previous_names":["darkterminal/turso-http-laravel"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkterminal%2Fturso-http-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkterminal%2Fturso-http-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkterminal%2Fturso-http-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkterminal%2Fturso-http-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darkterminal","download_url":"https://codeload.github.com/darkterminal/turso-http-laravel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142903,"owners_count":21054671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","laravel","libsql","php","sqlite","turso"],"created_at":"2024-09-24T21:27:19.289Z","updated_at":"2025-04-10T02:14:24.825Z","avatar_url":"https://github.com/darkterminal.png","language":"PHP","funding_links":["https://github.com/sponsors/darkterminal","https://saweria.co/darkterminal"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://docs.turso.tech/sdk/php/guides/laravel\"\u003e\n    \u003cimg alt=\"Turso + Laravel\" src=\"https://i.imgur.com/e3Pn6Rx.png\" width=\"1000\"\u003e\n    \u003ch3 align=\"center\"\u003eTurso + Laravel\u003c/h3\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  SQLite for Production. Powered by \u003ca href=\"https://turso.tech/libsql\"\u003elibSQL\u003c/a\u003e.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://turso.tech\"\u003e\u003cstrong\u003eTurso\u003c/strong\u003e\u003c/a\u003e ·\n  \u003ca href=\"#installation\"\u003e\u003cstrong\u003eQuickstart\u003c/strong\u003e\u003c/a\u003e ·\n  \u003ca href=\"#usage\"\u003e\u003cstrong\u003eExamples\u003c/strong\u003e\u003c/a\u003e ·\n  \u003ca href=\"#database-configuration\"\u003e\u003cstrong\u003eDocs\u003c/strong\u003e\u003c/a\u003e ·\n  \u003ca href=\"https://discord.com/invite/4B5D7hYwub\"\u003e\u003cstrong\u003eDiscord\u003c/strong\u003e\u003c/a\u003e ·\n  \u003ca href=\"https://blog.turso.tech/\"\u003e\u003cstrong\u003eBlog \u0026amp; Tutorials\u003c/strong\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003ch1 id=\"a-libsql-http-for-laravel\" align=\"center\"\u003eA LibSQL HTTP for Laravel\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://discord.gg/turso\"\u003e\n    \u003cpicture\u003e\n      \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://i.imgur.com/UhuW3zm.png\"\u003e\n      \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://i.imgur.com/vljWbfr.png\"\u003e\n      \u003cimg alt=\"Shows a black logo in light color mode and a white one in dark color mode.\" src=\"https://i.imgur.com/vGCC0I4.png\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Requirement\n\n-   Turso CLI - [Installation](https://docs.turso.tech/cli/introduction)\n-   Turso Account - [Register Here](https://tur.so/dt)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require darkterminal/turso-http-laravel\n```\n\nThen register the service provider at `bootstrap/providers.php` array:\n\n```php\nreturn [\n    App\\Providers\\AppServiceProvider::class,\n    Turso\\Http\\Laravel\\LibSQLHttpServiceProvider::class, // Here\n];\n```\n\n## Database Configuration\n\n```env\nDB_CONNECTION=libsql\nDB_DATABASE=\u003cyour-turso-database-url\u003e\nDB_AUTH_TOKEN=\u003cyour-turso-database-auth-token\u003e\n```\n\n## Database Configuration\n\nAdd this configuration at `config/database.php` inside the `connections` array:\n\n```php\n'libsql' =\u003e [\n    'driver' =\u003e 'libsql',\n    'url' =\u003e env('DB_DATABASE', ''),\n    'authToken' =\u003e env('DB_AUTH_TOKEN', ''),\n    'database' =\u003e null,\n    'prefix' =\u003e '',\n],\n```\n\n\u003e Copy and Paste and do not change it! Or try to change it and will broke your app or give you malfunction.\n\n## Usage\n\nFor database operation usage, everything have same interface like usual when you using `Illuminate\\Support\\Facades\\DB` in your database model. But remember, this is LibSQL they have `sync` method that can be used when you connect with Remote Replica Connection (Embedded Replica).\n\n```php\nuse Illuminate\\Support\\Facades\\DB;\n\n// Create\nDB::table('users')-\u003einsert([\n    'name' =\u003e 'Budi Dalton',\n    'email' =\u003e 'budi.dalton@duck.com'\n]);\n\n// Read\nDB::table('users')-\u003eget();\nDB::table('users')-\u003ewhere('id', 2)-\u003efirst();\nDB::table('users')-\u003eorderBy('id', 'DESC')-\u003elimit(2)-\u003eget();\n\n// Update\nDB::table('users')-\u003ewhere('id', 2)-\u003eupdate(['name' =\u003e 'Doni Mandala']);\n\n// Delete\nDB::table('users')-\u003ewhere('id', 2)-\u003edelete();\n\n// Transaction\ntry {\n    DB::beginTransaction();\n\n    $updated = DB::table('users')-\u003ewhere('id', 9)-\u003eupdate(['name' =\u003e 'Doni Kumala']);\n\n    if ($updated) {\n        echo \"It's updated\";\n        DB::commit();\n    } else {\n        echo \"Not updated\";\n        DB::rollBack();\n    }\n\n    $data = DB::table('users')-\u003eorderBy('id', 'DESC')-\u003elimit(2)-\u003eget();\n    dump($data);\n} catch (\\Exception $e) {\n    DB::rollBack();\n    echo \"An error occurred: \" . $e-\u003egetMessage();\n}\n\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n-   [Imam Ali Mustofa](https://github.com/darkterminal)\n-   [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkterminal%2Fturso-http-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarkterminal%2Fturso-http-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkterminal%2Fturso-http-laravel/lists"}