Container linking is legacy as of 1.9 and still functions, so compose files written last year keep working and nobody is forced to learn the replacement. The replacement is better in one way that matters: a user-defined network gives every container DNS.
version: '2'
services:
php:
build: ./docker/php
# no links needed — 'mysql' resolves on the default network
mysql:
image: mysql:5.7
# compose creates a network per project automatically
With links, a container could only reach what it was explicitly linked to, and the link was resolved at start — so restarting the database left the application pointing at a stale address. On a network, names resolve through an embedded DNS server on every lookup, so a restarted container is found again. Compose file version 2 creates the network for you, which is most of the reason to move to it.