---
lang: en
title: 'API docs: context.sortbindingsbyphase'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.sortbindingsbyphase.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [sortBindingsByPhase](./context.sortbindingsbyphase.md)

## sortBindingsByPhase() function

Sort bindings by phase names denoted by a tag and the predefined order

<b>Signature:</b>

```typescript
export declare function sortBindingsByPhase(bindings: Readonly<Binding<unknown>>[], phaseTagName?: string, orderOfPhases?: (string | symbol)[]): Readonly<Binding<unknown>>[];
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  bindings | <code>Readonly&lt;Binding&lt;unknown&gt;&gt;[]</code> | An array of bindings |
|  phaseTagName | <code>string</code> | Tag name for phase, for example, we can use the value <code>'a'</code> of tag <code>order</code> as the phase name for <code>binding.tag({order: 'a'})</code>. |
|  orderOfPhases | <code>(string &#124; symbol)[]</code> | An array of phase names as the predefined order |

<b>Returns:</b>

`Readonly<Binding<unknown>>[]`


