PHPackages                             dbp/relay-verity-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. dbp/relay-verity-bundle

ActiveSymfony-bundle

dbp/relay-verity-bundle
=======================

A validation bundle for the Relay API gateway

v0.1.9(5mo ago)111.4k↑270%[1 issues](https://github.com/digital-blueprint/relay-verity-bundle/issues)3AGPL-3.0-or-laterPHPPHP &gt;=8.2CI passing

Since Dec 10Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/digital-blueprint/relay-verity-bundle)[ Packagist](https://packagist.org/packages/dbp/relay-verity-bundle)[ RSS](/packages/dbp-relay-verity-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (25)Versions (14)Used By (3)

DbpRelayVerityBundle
====================

[](#dbprelayveritybundle)

[GitHub](https://gitlab.tugraz.at/398EE57581B44C9A/dbp-relay-verity) | [Packagist](https://packagist.org/packages/dbp/relay-verity-bundle)

The verity bundle provides an API for interacting with objects to validate (e.g. a PDF to validate against PDF/A-1b).

Bundle installation
-------------------

[](#bundle-installation)

You can install the bundle directly from [packagist.org](https://packagist.org/packages/dbp/relay-verity-bundle).

```
composer require dbp/relay-verity-bundle
```

Integration into the Relay API Server
-------------------------------------

[](#integration-into-the-relay-api-server)

- Add the bundle to your `config/bundles.php` in front of `DbpRelayCoreBundle`:

```
...
Dbp\Relay\VerityBundle\DbpRelayVerityBundle::class => ['all' => true],
Dbp\Relay\CoreBundle\DbpRelayCoreBundle::class => ['all' => true],
];
```

If you were using the [DBP API Server Template](https://packagist.org/packages/dbp/relay-server-template)as template for your Symfony application, then this should have already been generated for you.

- Run `composer install` to clear caches

Configuration
-------------

[](#configuration)

For this create `config/packages/dbp_relay_verity.yaml` in the app with the following content:

```
dbp_relay_verity:
  backends:
    pdfa:
      validator: 'Dbp\Relay\VerityConnectorVerapdfBundle\Service\PDFAValidationAPI'

  profiles:
    archive:
      name: 'Check PDFs for archiving complacency'
      rule: 'pdfa.validity == true && pdfa_b2.validity == true'
      checks:
        pdfa:
          backend: 'pdfa'
          config: '{"flavour": "1b"}'
        pdfa_b2:
          backend: 'pdfa'
          config: '{"flavour": "2b"}'
```

There are two sections in this bundle configuration:

1. `backends` for the configuration of backend services
2. `profiles` for the checks available via the API

In this example, a **backend** with the name `pdfa` is implemented by the PHP class `PDFAValidationAPI`. There is also a **profile** defines with the name `archive`. A profile performs all `checks` and stores the results (the `validity` and also `errors`) in a variable named like the **check**, here `pdfa` and `pdfa_b2`. Each check has the name of its `backend` to use and a `config` to set the type of check to perform. The results of all checks are then evaluated by the `rule` of the profile. The syntax of the rule is almost PHP syntax, but before any function is available, they must be registered first!

If you were using the [DBP API Server Template](https://packagist.org/packages/dbp/relay-server-template)as template for your Symfony application, then the configuration file should have already been generated for you.

For more info on bundle configuration see .

Development &amp; Testing
-------------------------

[](#development--testing)

- Install dependencies: `composer install`
- Run tests: `composer test`
- Run linters: `composer run lint`
- Run cs-fixer: `composer run cs-fix`

Bundle dependencies
-------------------

[](#bundle-dependencies)

Don't forget you need to pull down your dependencies in your main application if you are installing packages in a bundle.

```
# updates and installs dependencies of dbp/relay-verity-bundle
composer update dbp/relay-verity-bundle
```

Scripts
-------

[](#scripts)

Error codes
-----------

[](#error-codes)

### `/verity/reports`

[](#verityreports)

#### POST

[](#post)

relay:errorIdStatus codeDescription'verity:create-report-missing-profile'400Unknown profile "$profileName"!'verity:create-report-missing-file'400No file with parameter key "file" was received!'verity:create-report-file-hash-mismatch'400Parameter file hash mismatch.'verity:create-report-file-size-zero'400Parameter file size is 0 (zero).'verity:create-report-file-content-empty'400File content is empty.'verity:create-report-file-size-mismatch'400Parameter file size mismatch.'verity:create-report-backend-exception'400$profileName throws an exception### `/verity/reports/{identifier}`

[](#verityreportsidentifier)

#### GET

[](#get)

relay:errorIdStatus codeDescriptionrelay:errorDetailsExample`verity:report-not-found`404Submission was not found.Roles
-----

[](#roles)

This bundle needs the role `ROLE_SCOPE_VALIDATION` assigned to the user to get permissions to fetch data. To create a new submission entry the Symfony role `ROLE_SCOPE_VALIDATION-POST` is required.

Events
------

[](#events)

To extend the behavior of the bundle the following event is registered:

### VerityRequestEvent

[](#verityrequestevent)

This event allows you to send a request for validation internally. See `tests/EventSubscriberTest.php` as an example.

### VerityEvent

[](#verityevent)

This event allows you to get notifications for (all) verity reports.

An event subscriber receives a `Dbp\Relay\VerityBundle\Event\VerityEvent` instance:

```
