From this question we know that if $x\in\mathbb{R}^{n\times1}$ is a vector, then the (normalized) outer product matrix $$ \frac{x x^\top}{||x||^2}\, \in \mathbb{R}^{n\times n} $$ can operate on another vector $y\in\mathbb{R}^{n\times 1}$ and projects orthogonally onto the line spanned by $x$.
How does this generalize to a basis of vectors?
Suppose $X\in\mathbb{R}^{n\times m}$ is a matrix and let $[x_1 \, \cdots x_m]$ be its columns. I would like to find a matrix $A\in\mathbb{R}^{n\times n}$ such that it projects a vector $y\in\mathbb{R}^{n\times 1}$ onto the space spanned by the columns on $X$.