Search by

acrnogor / audit-api-bundle

acrnogor

Symfony bundle providing an API interface for damienharper/auditor-bundle audits.

Package info

github.com/acrnogor/audit-api-bundle

Type:symfony-bundle

pkg:composer/acrnogor/audit-api-bundle

Statistics

Installs: 55

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.9.16 2026-11-06 13:53 UTC

README

Symfony bundle providing an API interface for damienharper's audit bundle.

Requirements

  • PHP 8.4+
  • Symfony 6.4 or 7.x

Installation

composer require acrnogor/audit-api-bundle

With Symfony Flex, the bundle's recipe (a contrib recipe, so Flex asks you to confirm it) registers the bundle and creates the two files below.

Without Flex, enable the bundle in config/bundles.php and create those files yourself:

return [
    // ...
    Acrnogor\AuditApiBundle\AcrnogorAuditApiBundle::class => ['all' => true],
];

Configuration

# config/packages/acrnogor_audit_api.yaml
acrnogor_audit_api:
    enabled: true
    pagination:
        limit: 10
        max_limit: 100
    entity_classmap:
    # Map entity fqcn to its shortname (matched via router in url to make urls friendly), i.e:
    # App\Entity\User: user

Routes

# config/routes/acrnogor_audit_api.yaml
acrnogor_audit_api:
    resource: '@AcrnogorAuditApiBundle/src/Controller/'
    type: attribute
    prefix: /audit

Flex adds this file automatically; without Flex, create it manually.

Method Path Response
GET /audit/{shortName}/{entityId}/history Audit entries for the entity, newest first
GET /audit/{shortName}/{entityId}/{recordId} Single audit entry for the entity record

Note: {shortName} is the short name of the entity, as defined in the configuration. {entityId} is the primary key of the entity. {recordId} is the primary key of the audit record.

Security

Make sure you add the audit urls to your security firewall configuration, i.e.:

# config/packages/security.yaml
access_control:
    - { path: ^/audit, roles: ROLE_SUPER_ADMIN }

Flex recipe

The Flex recipe lives in recipe/ and is mirrored to symfony/recipes-contrib under acrnogor/audit-api-bundle/<version>/. Flex only reads recipes from recipe repositories, so any change here has to be submitted there to take effect.

Testing

composer install
vendor/bin/phpunit

License

MIT — see LICENSE.