# Introduction

Artificial Intelligence is changing how we write, search, and build software. Large Language Models (LLMs) are at the center of this transformation. They can understand text, answer questions, write code, and even reason about problems. Most developers think that creating an LLM requires deep math knowledge or powerful cloud infrastructure. But the truth is – you can start right where you are, using only PHP.

<div align="left"><figure><img src="/files/IdiJ4WkvqejW0x9bkUBv" alt="" width="563"><figcaption></figcaption></figure></div>

This book, *Build Your Own LLM with PHP*, is a complete journey into building and understanding your own language model using nothing but PHP. You will not depend on external AI services or heavy Python frameworks. Instead, you will see how far PHP can go on its own when it comes to working with text, numbers, and knowledge.

We will build everything step by step – from tokenization and vector math to embeddings, similarity search, and lightweight reasoning. You will learn how to create and train components of your model, store and query information efficiently, and make the system respond intelligently to questions.

By the end of this book, you will not just understand how an LLM works. You will have created one yourself – written fully in PHP, simple, transparent, and entirely yours.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apphp.gitbook.io/build-your-own-llm-in-php/getting-started/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
