Let $G$ be a topological group and $X$ be a paracompact Hausdorff topological space. For simplicity let us assume that $G$ has the homotopy type of a CW complex, although a lot of this answer does not need it. Then we can define the simplicial category of principal $G$-bundles over $X$ in the following way:

* Its objects are principal $G$-bundles $p:P\to X$
* Given two objects $p:P\to X$ and $p':P'\to X$, the simplicial set $\operatorname{Map}(p,p')$ has as $n$ simplices the equivariant continuous maps $f:P\times |\Delta^n|\to P'\times|\Delta^n|$ over $X\times|\Delta^n|$, where $|\Delta^n|=\{(t_0,\dots,t_n)\mid \sum_i t_i=1\}$ is the topological $n$-simplex.

Note that all the mapping simplicial sets are Kan complexes. Therefore we can take its simplicial nerve and we get an $\infty$-category. In fact it is easily seen to be an $\infty$-groupoid, a.k.a. a space, $\operatorname{Bun}_G(X)$, which I will call the **space of principal $G$-bundles over $X$**. Note that it is canonically pointed by the trivial bundle.

With some effort this can be made controvariantly functorial in $X$, with the functoriality given by the pullback of bundles (as usual, this is accomplished by constructing a suitable fibration over the category of topological spaces -- the details are left as an exercise).

I am going to claim that $\operatorname{Bun}_G(X)$ is equivalent to $\operatorname{Map}(X,BG)$ where $BG$ is the classifying space of $G$.

The quickest proof I know of this fact is by proving that $\operatorname{Bun}_G(-)$ is a sheaf on paracompact Hausdorff spaces for the open covering topology (this requires some work -- in particular you have to show that the restriction map $\operatorname{Map}(p,p')\to \operatorname{Map}(p|_U,p'|_U)$ to an open subset is a Kan fibration).

Then it is easy to see that its sheaf $\pi_0$ is trivial and that $\Omega\operatorname{Bun}_G(-)$ is the constant sheaf at $G$ (this follows from the fact that if $L$ is a space homotopy equivalent to a CW-complex, the constant sheaf at the weak homotopy type of $L$ is given by the simplicial mapping space $U\mapsto \operatorname{Map}(U,L)$, by combining Corollary 7.1.4.4 and Proposition 7.1.5.1 in Higher Topos Theory). Therefore the recognition theorem for loopspaces in an $\infty$-topos shows that $\operatorname{Bun}_G(-)$ is the constant sheaf at $BG$. Finally, arguing as in [*Higher Algebra* Remark A.1.4] we see that the constant sheaf at $BG$ is exactly $\operatorname{Map}(-,BG)$.

---

A similar argument shows that the space of fiber bundles with fiber $F$ is equivalent to the space $\operatorname{Map}(X,B\operatorname{Homeo}(F))$, where $\operatorname{Homeo}(F)$ is the simplicial group of homeomorphisms of $F$.