Run the following in your project root, assuming you have composer set up for your project
composer require happyr/api-bundle
Add the bundle to app/AppKernel.php
$bundles = [
// ...
new Happyr\ApiBundle\HappyrApiBundle(),
];
Wsse is built in and can be enabled - disabled by default.
To enable and configure it, in config.yml add
happyr_api:
wsse:
user_provider: "security.user.provider.concrete.in_memory"
cache_service: "cache.provider.redis"
lifetime: 300
debug: false # Set to true to disable WSSE completely. You will always be authenticated.
And in security.yml configure your provider where you store users to something like this
security:
providers:
in_memory:
memory:
users:
username:
password: password
roles: ['ROLE_API_USER']
And under firewalls in security.yml, add a new firewall like so
security:
firewalls:
main:
pattern: ^/api/
stateless: true
wsse: true
Exception listener is enabled by default. It will catch uncaught exceptions and return formatted json response.
Here is an example configuration:
happyr_api:
exception_listener:
enabled: false # disables response listener
path_prefix: '/api/' # path prefix to enable listener on. By default its enabled for any path