There are several algorithms available which can attack a Playfair cipher.
Hill climbing might be one option. Basically it starts with a random key (assuming it's the best one) and decrypts the cipher. The resulting clear text is scored using a fitness function. Then small changes are applied to the key and if the resulting clear text of the modified key scores better, the modified key is regarded as the best key and the process of applying small changes to the key starts over again until no better key can be found.
Sometimes Hill Climbing does not find the best solution, the algorithm gets stuck at a local maximum. An effective way to resolve this issue is to use the Shotgun hill climbing (refer to the Wikipedia link provided above).
The Simulated Annealing Algorithm is another option, see also here.
Or you can use the Genetic Algorithm. The algorithm mimics the process of natural selection.
If you are interested in an online Playfair breaker. I think here the hill climbing algorithm is used. It is coded in Javascript, so the source can be studied.
If you are interested in how a clear text can be scored:
Quadgram Statistics as a Fitness Measure.