В симфони 4 можно, например, так (config/routes/annotations.yaml)
controllers: resource: ../../src/Controller/ type: annotation api-v1-controllers: resource: ../../src/Controller/Api type: annotation defaults: _format: json prefix: /api/v1