> For the complete documentation index, see [llms.txt](https://docs.payum.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payum.dev/v2/di.md).

# Dependency Injection

Starting with Payum 2.0 the library is wired together by a dependency injection container powered by [PHP-DI](https://php-di.org/). Gateways, actions, extensions and the services they depend on are declared as container definitions instead of being assembled by hand, and shared services such as the PSR-18 HTTP client or the token storage are created once and reused by every gateway.

This section explains how the container is put together, how to customize it, and how to plug it into your framework.

### Guides

* [Getting started](/v2/di/getting-started.md) — the container architecture, `PayumBuilder`, global services and how to write a gateway factory.
* [Customization](/v2/di/customization.md) — override default services, register your own, and hand Payum a container of your own.
* [Framework integration](/v2/di/framework-integration.md) — Symfony, Laravel, plain PHP and custom frameworks.
* [Migration guide: v1.x to v2.0](/v2/di/migration-guide.md) — map `populateConfig()` and `ApiAwareInterface` onto the new container.

### Where to start

| If you are...                                      | Read                                                                                                                                             |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| New to Payum 2.0                                   | [Getting started](/v2/di/getting-started.md)                                                                                                     |
| Upgrading from Payum 1.x                           | [Migration guide](/v2/di/migration-guide.md)                                                                                                     |
| Replacing the HTTP client, logger or token storage | [Customization](/v2/di/customization.md)                                                                                                         |
| Wiring Payum into Symfony or Laravel               | [Framework integration](/v2/di/framework-integration.md)                                                                                         |
| Writing your own gateway                           | [Getting started](/v2/di/getting-started.md#writing-a-gateway-factory), then [Develop a custom Payum gateway](/v2/develop-gateway-with-payum.md) |

See [The Architecture](/v2/the-architecture.md) for the request/action/reply model that the container wires up.

***

### Supporting Payum

Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:

* [Become a sponsor](https://github.com/sponsors/Payum)


---

# 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://docs.payum.dev/v2/di.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.
