An ability that reads “Whenever [a player] attacks, . . .” triggers if one or more creatures that player controls are declared as attackers.
May 3, 2019 · War of the Spark
An ability that reads “Whenever [a creature] attacks and isn’t blocked, . . .” triggers during the declare blockers step, not the declare attackers step. See rule 509.5g.
January 25, 2019 · Ravnica Allegiance
An ability that reads "Whenever [a creature] attacks and isn't blocked, . . ." triggers during the declare blockers step, not the declare attackers step. See rule 509.5g.
August 25, 2017 · Commander 2017
An ability that reads “Whenever [a creature] attacks and isn’t blocked, . . .” triggers during the declare blockers step, not the declare attackers step. See rule 509.5g.