<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector-qre33ssfb" -->

---
title: Build an “ask the docs” app with Laravel 13 and MariaDB...
description: Laravel 13 supports MariaDB Vector natively, letting you store embeddings and run similarity search in the same database as your app data, without extra...
canonical: https://daily.dev/posts/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector-qre33ssfb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Build an “ask the docs” app with Laravel 13 and MariaDB Vector | daily.dev
og:description: Laravel 13 supports MariaDB Vector natively, letting you store embeddings and run similarity search in the same database as your app data, without extra...
og:url: https://daily.dev/posts/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector-qre33ssfb
og:image: https://api.daily.dev/og/posts/QRE33SSFb.png
og:image:alt: Build an “ask the docs” app with Laravel 13 and MariaDB Vector
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Build an “ask the docs” app with Laravel 13 and MariaDB Vector

**[MariaDB.org](https://daily.dev/sources/mariadb-foundation)** · 14 min read · 0 upvotes · 0 comments

## Summary

Laravel 13 supports MariaDB Vector natively, letting you store embeddings and run similarity search in the same database as your app data, without extra packages or raw SQL. A tutorial by Mohamed Touhami Rhaima builds a reference app that chunks markdown files, embeds each passage with the Laravel AI SDK, stores vectors with the AsVector cast, and searches them with selectVectorDistance() and whereVectorSimilarTo(). It uses MariaDB's HNSW index with cosine distance, requires the mariadb driver rather than mysql, and passes matched passages to an AI agent for retrieval-augmented answers. The guide also covers running embeddings locally with Ollama's nomic-embed-text model and tuning the similarity cut-off per embedding model. Full code is on GitHub.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://mariadb.org/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector>

## Questions this post answers

### How do I use MariaDB Vector with Laravel 13 without any extra packages?

Laravel 13 supports MariaDB Vector natively when paired with MariaDB 11.7 or later. Use $table->vector() and $table->vectorIndex() in a migration to create the column and its HNSW index, the AsVector cast to read and write embeddings as PHP arrays, and selectVectorDistance() plus whereVectorSimilarTo() in the query builder for similarity search, all without raw SQL or extra database packages.

_Building vector search into a Laravel app? daily.dev surfaces the latest framework changes before they bite you._

### Why do vector queries fail when connecting Laravel to MariaDB with the mysql driver?

The mysql driver doesn't understand MariaDB's SQL dialect, so vector indexes can't be created and vector distance queries are disabled when Laravel connects to a MariaDB server with it. It also turns uuid() columns into char(36) instead of MariaDB's native uuid type. Set DB_CONNECTION=mariadb instead to get full vector support.

_Picking the right database driver settings matters; daily.dev helps developers avoid these configuration traps._

### How do I choose a similarity cut-off (minSimilarity) for vector search in Laravel?

The right cut-off depends on the embedding model, since distance scales differ between models. With OpenAI's text-embedding-3-small, relevant passages for a sample question fell between 0.33 and 0.60 distance, well separated by a minSimilarity of 0.25. With Ollama's nomic-embed-text, relevant matches ran 0.23 to 0.38 while unrelated text still matched at 0.64 to 0.66, requiring a higher cut-off of 0.45 to filter correctly.

_Tuning search relevance across embedding models is exactly the kind of detail daily.dev helps engineers track down._

## Similar posts on daily.dev

- [Laravel 13 now supports MariaDB Vector natively](https://daily.dev/posts/laravel-13-now-supports-mariadb-vector-natively-moxv4b4ls) · MariaDB.org · 10 upvotes · 0 comments
- [Ship AI with Laravel: RAG with Embeddings and pgvector in Laravel 13](https://daily.dev/posts/ship-ai-with-laravel-rag-with-embeddings-and-pgvector-in-laravel-13-h7gbkwt89) · Laravel News · 5 upvotes · 0 comments
- [Laravel AI Integration: Build a Document Search Agent](https://daily.dev/posts/laravel-ai-integration-build-a-document-search-agent-0cerhbf4d) · Laravel · 12 upvotes · 0 comments
- [Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB](https://daily.dev/posts/personalized-content-delivery-system-building-an-ai-powered-recommendation-engine-with-laravel-and--eeklolvwa) · Laravel News · 1 upvotes · 0 comments

---

Tags: [#infrastructure](https://daily.dev/tags/infrastructure), [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel), [#rag](https://daily.dev/tags/rag), [#vector-search](https://daily.dev/tags/vector-search)

[View this post on daily.dev](https://daily.dev/posts/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector-qre33ssfb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Build an “ask the docs” app with Laravel 13 and MariaDB Vector","url":"https://daily.dev/posts/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector-qre33ssfb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector-qre33ssfb"},"datePublished":"2026-10-28T07:58:37.739Z","dateModified":"2026-10-28T08:00:33.797Z","description":"Laravel 13 supports MariaDB Vector natively, letting you store embeddings and run similarity search in the same database as your app data, without extra...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fea8f693698adebb612cc936b4c47630?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fea8f693698adebb612cc936b4c47630?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"MariaDB.org","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"MariaDB.org","logo":"https://media.daily.dev/image/upload/s--onniydaR--/f_auto,q_auto/v1787487510/logos/mariadb-foundation?_a=BAMAMicg0","url":"https://daily.dev/sources/mariadb-foundation"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector-qre33ssfb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"infrastructure,php,laravel,rag,vector-search","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"MariaDB.org","item":"https://daily.dev/sources/mariadb-foundation"},{"@type":"ListItem","position":3,"name":"Build an “ask the docs” app with Laravel 13 and MariaDB Vector"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/build-an-ask-the-docs-app-with-laravel-13-and-mariadb-vector-qre33ssfb#faq","mainEntity":[{"@type":"Question","name":"How do I use MariaDB Vector with Laravel 13 without any extra packages?","acceptedAnswer":{"@type":"Answer","text":"Laravel 13 supports MariaDB Vector natively when paired with MariaDB 11.7 or later. Use $table-\u003evector() and $table-\u003evectorIndex() in a migration to create the column and its HNSW index, the AsVector cast to read and write embeddings as PHP arrays, and selectVectorDistance() plus whereVectorSimilarTo() in the query builder for similarity search, all without raw SQL or extra database packages. Building vector search into a Laravel app? daily.dev surfaces the latest framework changes before they bite you."}},{"@type":"Question","name":"Why do vector queries fail when connecting Laravel to MariaDB with the mysql driver?","acceptedAnswer":{"@type":"Answer","text":"The mysql driver doesn't understand MariaDB's SQL dialect, so vector indexes can't be created and vector distance queries are disabled when Laravel connects to a MariaDB server with it. It also turns uuid() columns into char(36) instead of MariaDB's native uuid type. Set DB_CONNECTION=mariadb instead to get full vector support. Picking the right database driver settings matters; daily.dev helps developers avoid these configuration traps."}},{"@type":"Question","name":"How do I choose a similarity cut-off (minSimilarity) for vector search in Laravel?","acceptedAnswer":{"@type":"Answer","text":"The right cut-off depends on the embedding model, since distance scales differ between models. With OpenAI's text-embedding-3-small, relevant passages for a sample question fell between 0.33 and 0.60 distance, well separated by a minSimilarity of 0.25. With Ollama's nomic-embed-text, relevant matches ran 0.23 to 0.38 while unrelated text still matched at 0.64 to 0.66, requiring a higher cut-off of 0.45 to filter correctly. Tuning search relevance across embedding models is exactly the kind of detail daily.dev helps engineers track down."}}]}
```

