> For the complete documentation index, see [llms.txt](https://php-fhir-tools.ardenexal.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://php-fhir-tools.ardenexal.net/contributing/setup.md).

# Development Setup

## Prerequisites

* **PHP 8.3** or higher
* **Composer**
* PHP extensions: `bcmath`, `ctype`, `iconv`, `zip`

## Clone and install

```bash
git clone https://github.com/Ardenexal/php-fhir-tools.git
cd php-fhir-tools
composer install
```

## Verify your setup

```bash
composer quality:all   # lint + phpstan + test
```

`quality:all` chains three steps defined in `composer.json`: `@lint` (Laravel Pint code-style fixes), `@phpstan` (PHPStan level 8 static analysis), and `@test` (the full PHPUnit suite).

## Quality commands

The individual scripts that `quality:all` composes:

| Command            | What it does                              |
| ------------------ | ----------------------------------------- |
| `composer lint`    | Fix code style with Laravel Pint (PSR-12) |
| `composer phpstan` | Static analysis at PHPStan level 8        |
| `composer test`    | Run the full PHPUnit suite                |

### Per-component quality checks

Each component has scoped variants, for example:

```bash
composer quality:bundle
composer quality:codegen
composer quality:serialization
composer quality:fhir-path
composer quality:validation
```

{% hint style="info" %}
**`-ai` variants.** This repo also defines AI-friendly runners with compact output: `composer phpstan-ai`, `composer test-ai`, and scoped forms such as `composer test-ai-unit` and `composer phpstan-ai:serialization`. Per repository policy, contributors working through an agent harness use these `-ai` variants; the plain `phpstan`/`test` scripts produce the same analysis with verbose output. Note there is no `lint-ai` — use `composer lint` for code style.
{% endhint %}

{% hint style="warning" %}
Generated model files under `src/Component/Models/src/` must never be hand-edited — regenerate via `php demo/bin/console fhir:generate` (or `composer run generate-models-all`).
{% endhint %}

See [testing.md](/contributing/testing.md) for the test layout and utilities, and [commit-standards.md](/contributing/commit-standards.md) for commit conventions.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://php-fhir-tools.ardenexal.net/contributing/setup.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.
