---
title: "Building a RESTful API with PHP and SQLite"
description: "A minimal CRUD REST API in PHP can be built with Dumbo, a small Hono-inspired routing framework, and Turso's experimental HTTP-only PHP SDK for libSQL/SQLite."
url: "https://swe.quest/articles/building-a-restful-api-with-php-and-sqlite-893ffe1a1d128ccc"
canonical: "https://turso.tech/blog/building-a-restful-api-with-php-and-sqlite"
source: "Turso"
published: "2024-09-04"
difficulty: "medium"
kind: "How-to"
reading_minutes: 5
tags: ["php","sqlite","api-design"]
---

# Building a RESTful API with PHP and SQLite

A post on [Turso](https://swe.quest/sources/turso.md), published 2024-09-04, 5 min read, How-to. Original: [https://turso.tech/blog/building-a-restful-api-with-php-and-sqlite](https://turso.tech/blog/building-a-restful-api-with-php-and-sqlite)

## Summary

A minimal CRUD REST API in PHP can be built with Dumbo, a small Hono-inspired routing framework, and Turso's experimental HTTP-only PHP SDK for libSQL/SQLite. The walkthrough covers Composer setup, a users table schema, connecting via a DSN with database URL and auth token, and GET/POST/PUT/DELETE routes using parameterized queries, RETURNING clauses and dynamic SET clauses for partial updates. Testing uses PHP's built-in server and cURL. Production use still needs proper validation, authentication, CORS and error handling.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PHP](https://swe.quest/tags/php.md) (Languages)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)

## Prerequisites

- PHP basics ([easy posts on PHP](https://swe.quest/tags/php.md?difficulty=easy))
- Composer
- REST APIs ([easy posts on API design](https://swe.quest/tags/api-design.md?difficulty=easy))
- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))

## Keywords

Turso, Dumbo, libSQL, Hono, Composer

## Related posts

- [Create a fast, performant admin UI with Retool and Turso](https://swe.quest/articles/create-a-fast-performant-admin-ui-with-retool-and-turso-5c186550c3794073.md): Turso · 2023-11-16 · Medium · 7 min read · SQLite, Product engineering, E-commerce
  A Retool admin dashboard for an e-commerce mug store can read and write data in a Turso (libSQL) database through Turso's HTTP API, configured as a Retool REST API resource.
- [Mobile app prototyping with Quasar and SQLite](https://swe.quest/articles/mobile-app-prototyping-with-quasar-and-sqlite-9c2497ace27025c4.md): Turso · 2024-01-05 · Medium · 8 min read · SQLite, Mobile, Frontend, JavaScript
  A recipe-book mobile prototype built with the Vue-based Quasar framework, backed by a local SQLite file accessed through a small Express server using the libSQL JavaScript client.
- [Announcing Laravel Support and PHP PDO Interface](https://swe.quest/articles/announcing-laravel-support-and-php-pdo-interface-98c2c7a584efdc2c.md): Turso · 2025-01-09 · Medium · 4 min read · PHP, SQLite, Vector search
  Turso has released \`libsql-laravel\`, an official open-source Laravel adapter, along with a PHP PDO interface.
- [Write that blog… with Turso!](https://swe.quest/articles/write-that-blog-with-turso-eb57ed9c715594d8.md): Turso · 2024-10-08 · Medium · 4 min read · SQLite, Databases, Frontend
  WriteThatBlog!, an aggregator of engineering blog posts tagged by writing pattern, is a single static HTML page on GitHub Pages that queries a replicated Turso database directly from the browser over HTTP, with no backend functions or proxies.
- [Bringing SQLite to Vercel Functions with Turso](https://swe.quest/articles/bringing-sqlite-to-vercel-functions-with-turso-afed2a49c7b44020.md): Turso · 2026-02-19 · Medium · 8 min read · SQLite, Serverless, Replication, Multi-tenancy, JavaScript
  Turso's partial sync replicates a subset of SQLite database pages into Vercel Functions so reads run in-process with no network round-trip, while writes go to the remote Turso database for durability and consistency.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
