  We employ a three fluid model in order to construct a cosmological model in
the Friedmann Robertson Walker flat spacetime, which contains three types of
matter dark energy, dark matter and a perfect fluid with a linear equation of
state. Dark matter is described by dust and dark energy with a scalar field
with potential V({\phi}). In order to fix the scalar field potential we demand
Lie symmetry invariance of the field equations, which is a model-independent
assumption. The requirement of an extra Lie symmetry selects the exponential
scalar field potential. The further requirement that the analytic solution is
invariant under the point transformation generated by the Lie symmetry
eliminates dark matter and leads to a quintessence and a phantom cosmological
model containing a perfect fluid and a scalar field. Next we assume that the
Lagrangian of the system admits an extra Noether symmetry. This new assumption
selects the scalar field potential to be exponential and forces the perfect
fluid to be stiff. Furthermore the existence of the Noether integral allows for
the integration of the dynamical equations. We find new analytic solutions to
quintessence and phantom cosmologies which contain all three fluids. Using
these solutions one is able to compute analytically all main cosmological
functions, such as the scale factor, the scalar field, the Hubble expansion
rate, the deceleration parameter etc.
