> For the complete documentation index, see [llms.txt](https://quantumphp.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quantumphp.gitbook.io/docs/packages/app/overview.md).

# Overview

The App package is Quantum's bootstrap and runtime entry point.

Use it when you need to start either a web request lifecycle or a console command lifecycle from a project base directory.

## What the package provides

* `AppFactory` for creating the runtime entry point
* `App` as the adapter-backed application object
* `AppContext` for base-directory and DI-backed shared runtime access
* built-in `web` and `console` adapters
* bootstrap stages for helpers, environment, config, HTTP, debugger, modules, and error handling
* path and utility helpers such as `base_dir()`, `modules_dir()`, `slugify()`, and `uuid_random()`

## Quick start

### Boot a web app

```php
use Quantum\App\Factories\AppFactory;
use Quantum\App\Enums\AppType;

$app = AppFactory::create(AppType::WEB, __DIR__);
$app->start();
```

### Boot a console app

```php
use Quantum\App\Factories\AppFactory;
use Quantum\App\Enums\AppType;

$app = AppFactory::create(AppType::CONSOLE, __DIR__);
$exitCode = $app->start();
```

## When to use it

Use the App package when you are wiring framework startup itself:

* front controllers such as `public/index.php`
* CLI entry points such as `qt`
* tests or tools that need a full Quantum app instance

Most application code should use downstream packages like Router, Http, View, or Console instead of talking to App internals directly.

## Important behavior

`AppFactory::create()` caches one `App` instance per app type.

Practical effect:

* the first `web` app created in a process is reused for later `web` calls
* the first `console` app created in a process is reused for later `console` calls
* changing the base directory in a later call does not create a new instance for the same type

If you need a fresh runtime for the same type, call `AppFactory::destroy($type)` before creating it again.


---

# 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, and the optional `goal` query parameter:

```
GET https://quantumphp.gitbook.io/docs/packages/app/overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
