Slide 25
Slide 25 text
basecom · wir sprechen internet 25
Listeners – 2. Format Listener
# app/config/config.yml
fos_rest:
format_listener:
enabled: true
rules:
- path: '^/'
host: 'api.%domain%'
priorities: ['json', 'xml']
fallback_format: json
prefer_extension: false
- path: '^/api'
priorities: [ 'xml', 'json']
fallback_format: xml
attributes: { _controller: FOS\RestBundle\Controller\ExceptionController }
prefer_extension: false
- path: '^/'
priorities: [ 'text/html', '*/*']
fallback_format: html
prefer_extension: true