Link

Advice

The piece that you were missing…


Types of advices

Before

Description

Advice that must be executed before a function/method invocation.

Use cases

  • Trace functions and methods calls.
  • Populate arguments with external data before being processed.
  • Normalize arguments before being passed to functions and methods.
  • Arguments validation.
  • Security checks.

Go to section “Before advices”


Returning

Description

Advice that must be executed after a function/method invocation.

Use cases

  • Update fields depending on output response.
  • Normalize results.
  • Check errors and manipulate them.
  • Throw business errors depending on the results.

Go to section “Returning advices”


Around

Description

Advice that surrounds a function/method invocation.

Use cases

  • Implement custom and smart memorize advices.
  • Timing your functions and methods.
  • Metric your function and methods.

Go to section “Around advices”