Attribute Reference: All Winter Boot Attributes
Winter Boot’s programming model is built on PHP 8 attributes. This page lists every attribute the framework provides, grouped by area, with a one-line description and a link to the page that documents it.
Application bootstrap
Section titled “Application bootstrap”| Attribute | Namespace | Purpose |
|---|---|---|
#[WinterBootApplication] |
dev\winterframework\stereotype |
Marks the entry-point class and configures scan paths, config directories, and enabled features. |
#[Configuration] |
dev\winterframework\stereotype |
Declares a bean-producing class whose #[Bean] methods contribute beans to the container. |
#[PostConstruct] |
dev\winterframework\stereotype |
Marks a bean method to run after all dependencies are injected. |
#[OnApplicationReady] |
dev\winterframework\stereotype |
On a bean class implementing ApplicationReadyEvent: its onApplicationReady() runs once the context is ready. |
#[OnWorkerStart], #[OnWorkerStop] |
dev\winterframework\stereotype |
On a bean class implementing WorkerStartEvent / WorkerStopEvent: runs in each Swoole worker as it starts / stops. |
#[Module] |
dev\winterframework\stereotype |
Registers a class as a Winter module (see Module System). |
#[EnableTransactionManagement], #[EnableCaching], #[EnableAsync], #[EnableScheduling] |
see sections below | Feature switches placed on the #[WinterBootApplication] class. |
See Application Lifecycle and Configuration.
Dependency injection
Section titled “Dependency injection”| Attribute | Namespace | Purpose |
|---|---|---|
#[Service] |
dev\winterframework\stereotype |
Registers a service-layer bean. |
#[Component] |
dev\winterframework\stereotype |
Registers a generic bean. |
#[Autowired] |
dev\winterframework\stereotype |
Injects a bean into a property, by type or by name. |
#[Bean] |
dev\winterframework\stereotype |
Marks a #[Configuration] method as a bean factory. |
#[Qualifier] |
dev\winterframework\stereotype |
On a constructor or #[Bean] method parameter: picks a bean by name. |
#[Value] |
dev\winterframework\stereotype |
Injects a configuration value ('${key.path}') into a property. |
#[JsonProperty] |
dev\winterframework\stereotype |
Maps a PHP property to a JSON key when binding input (see JSON & XML). |
Read Dependency Injection for full usage.
Web and REST
Section titled “Web and REST”| Attribute | Namespace | Purpose |
|---|---|---|
#[RestController] |
dev\winterframework\stereotype |
Declares a REST controller bean. |
#[RequestMapping] |
dev\winterframework\stereotype\web |
Maps a class or method to an HTTP path. |
#[GetMapping] |
dev\winterframework\stereotype\web |
Maps a method to GET. |
#[PostMapping] |
dev\winterframework\stereotype\web |
Maps a method to POST. |
#[PutMapping] |
dev\winterframework\stereotype\web |
Maps a method to PUT. |
#[PatchMapping] |
dev\winterframework\stereotype\web |
Maps a method to PATCH. |
#[DeleteMapping] |
dev\winterframework\stereotype\web |
Maps a method to DELETE. |
#[PathVariable] |
dev\winterframework\stereotype\web |
Binds a URI path segment to a parameter. |
#[RequestParam] |
dev\winterframework\stereotype\web |
Binds a query, form, cookie, or header value to a parameter. |
#[RequestBody] |
dev\winterframework\stereotype\web |
Binds the parsed request body (JSON, XML, form, multipart) to a parameter. |
#[McpTool] |
dev\winterframework\stereotype\mcp |
Serves a REST endpoint or a service method as a Model Context Protocol tool on POST /mcp. |
#[McpResource] |
dev\winterframework\stereotype\mcp |
Serves a service method as an MCP resource: a fixed URI or a URI template (2.1.7+). |
#[McpPrompt] |
dev\winterframework\stereotype\mcp |
Serves a service method as an MCP prompt template (2.1.7+). |
See REST Controllers, Request Mapping and MCP Tools.
Data, PPA, and transactions
Section titled “Data, PPA, and transactions”| Attribute | Namespace | Purpose |
|---|---|---|
#[Table] |
dev\winterframework\stereotype\ppa |
Maps a PHP class to a database table. |
#[Column] |
dev\winterframework\stereotype\ppa |
Maps a PHP property to a column. |
#[SequenceGenerator] |
dev\winterframework\stereotype\ppa |
Declares a sequence-backed ID generator. |
#[TableGenerator] |
dev\winterframework\stereotype\ppa |
Declares a table-backed ID generator. |
#[EnableTransactionManagement] |
dev\winterframework\stereotype\txn |
Enables #[Transactional] on the application. |
#[Transactional] |
dev\winterframework\txn\stereotype |
Wraps a method in a database transaction. |
See Datasources, Transactions, SQL Migrations, and OpenSearch Migrations.
Async, scheduling, and concurrency
Section titled “Async, scheduling, and concurrency”| Attribute | Namespace | Purpose |
|---|---|---|
#[EnableAsync] |
dev\winterframework\stereotype\task |
Enables #[Async] on the application. |
#[Async] |
dev\winterframework\task\async\stereotype |
Dispatches a method to a background worker. |
#[EnableScheduling] |
dev\winterframework\stereotype\task |
Enables #[Scheduled] on the application. |
#[Scheduled] |
dev\winterframework\task\scheduling\stereotype |
Runs a method at a fixed rate or with a fixed delay (seconds). |
#[DaemonThread] |
dev\winterframework\stereotype\cli |
Runs a ServerWorkerProcess subclass as a supervised background process. |
#[Lockable] |
dev\winterframework\stereotype\concurrent |
Lets only one caller run a method at a time, per node or cluster-wide. |
See Async Tasks, Scheduled Tasks, Daemon Threads, and Locking.
Caching
Section titled “Caching”| Attribute | Namespace | Purpose |
|---|---|---|
#[EnableCaching] |
dev\winterframework\stereotype\cache |
Enables method-level caching attributes. |
#[Cacheable] |
dev\winterframework\cache\stereotype |
Caches a method’s return value. |
#[CachePut] |
dev\winterframework\cache\stereotype |
Updates the cached entry after a method runs. |
#[CacheEvict] |
dev\winterframework\cache\stereotype |
Invalidates cached entries. |
See Caching.
| Attribute | Namespace | Purpose |
|---|---|---|
#[StereoTyped] |
dev\winterframework\stereotype |
Marks your own attribute class as a Winter stereotype. Custom AOP attributes also implement the AopStereoType interface and return a WinterAspect interceptor. |
Telemetry
Section titled “Telemetry”| Attribute | Namespace | Purpose |
|---|---|---|
#[Traceable] |
dev\winterframework\telemetry\stereotype |
Wraps a method in an OpenTelemetry span. |
#[Countable] |
dev\winterframework\telemetry\metrics |
Increments an OpenTelemetry counter on every call. |
See Telemetry.
XML binding (PAXB)
Section titled “XML binding (PAXB)”| Attribute | Namespace | Purpose |
|---|---|---|
#[XmlRootElement] |
dev\winterframework\paxb\attr |
Maps a class to an XML root element. |
#[XmlElement] |
dev\winterframework\paxb\attr |
Maps a property to a child element. |
#[XmlAttribute] |
dev\winterframework\paxb\attr |
Maps a property to an XML attribute. |
#[XmlValue] |
dev\winterframework\paxb\attr |
Maps a property to the element’s text content. |
#[XmlAnyElement], #[XmlAnyAttribute] |
dev\winterframework\paxb\attr |
Capture unmatched elements or attributes. |
#[XmlPropertyOrder] |
dev\winterframework\paxb\attr |
Sets the order of child elements when writing XML. |
See JSON & XML.
Actuator
Section titled “Actuator”| Attribute | Namespace | Purpose |
|---|---|---|
#[HealthInformer] |
dev\winterframework\actuator\stereotype |
Contributes a health check to the actuator endpoint. |
#[InfoInformer] |
dev\winterframework\actuator\stereotype |
Contributes an info payload to the actuator endpoint. |
See Actuator.
Testing
Section titled “Testing”| Attribute | Namespace | Purpose |
|---|---|---|
#[WinterBootTest] |
dev\winterframework\stereotype\test |
Registers a test class as a bean so services can be injected into it. |
See Testing.