We give a general method to find exact cosmological solutions for scalar-field dark energy in the presence of perfect fluids. We use the existence of invariant transformations for the Wheeler De Witt (WdW) equation. We show that the existence of a point transformation under which the WdW equation is invariant is equivalent to the existence of conservation laws for the field equations, which indicates the existence of analytical solutions. We extend previous work by providing exact solutions for the Hubble parameter and the effective dark-energy equation of state parameter for cosmologies containing a combination of perfect fluid and a scalar field whose self-interaction potential is a power of hyperbolic functions. We find solutions explicitly when the perfect fluid is radiation or cold dark matter and determine the effects of non-zero spatial curvature. Using the Planck 2015 data, we determine the evolution of the effective equation of state of the dark energy. Finally, we study the global dynamics using dimensionless variables. We find that if the current cosmological model is Liouville integrable (admits conservation laws) then there is a unique stable point which describes the de-Sitter phase of the universe.