A symfony bundle for Tessi Data Content. | Read-only mirror of https://github.com/republique-et-canton-de-geneve/php-symfony-data-content-bundle — République et canton de Genève. Issues & pull requests at the source.
  • PHP 98.8%
  • Shell 1.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-28 09:28:50 +02:00
.github ci(ci): upgrade php version to 8.4 in workflows and docs 2026-08-25 16:00:50 +02:00
.vscode DataContent Bundle 2026-03-30 16:16:38 +02:00
cmd Refactor rector commands to remove redundant 'src' argument and simplify test callbacks 2026-04-17 17:09:54 +02:00
config/packages refactor(service): improve JSON parsing and simplify bundle configuration 2026-08-26 12:01:07 +02:00
doc refactor(service): cleanup unused security code and fix config key 2026-08-26 16:24:17 +02:00
src style(service): fix whitespace in DriverDataContent.php 2026-08-28 09:25:48 +02:00
tests feat(service): add documentType option and replace security with token authenticator 2026-08-26 16:13:41 +02:00
.gitattributes chore(git): ignore doc directory in git attributes 2026-08-26 16:44:13 +02:00
.gitignore feat(core): enhance exception handling and add tenant configuration 2026-08-25 10:52:33 +02:00
.php-cs-fixer.php DataContent Bundle 2026-03-30 16:16:38 +02:00
bundle-analysis.md chore(docs): add bundle analysis report 2026-08-26 14:32:59 +02:00
composer.json build(deps): upgrade development dependencies and refine configuration 2026-08-26 10:41:14 +02:00
coverage_branch.svg chore: GithubAction update code coverage results 2026-04-02 12:43:13 +00:00
coverage_line.svg chore: GithubAction update code coverage results 2026-08-26 12:02:27 +00:00
LICENSE DataContent Bundle 2026-03-30 16:16:38 +02:00
phpstan.neon build(deps): upgrade development dependencies and refine configuration 2026-08-26 10:41:14 +02:00
phpunit.xml build(deps): upgrade development dependencies and refine configuration 2026-08-26 10:41:14 +02:00
README.md feat(service): add documentType option and replace security with token authenticator 2026-08-26 16:13:41 +02:00
rector.php feat(core): enhance exception handling and add tenant configuration 2026-08-25 10:52:33 +02:00
SECURITY.md docs(security): simplify supported version documentation 2026-08-26 14:20:55 +02:00

php-symfony-data-content-bundle

Symfony bundle for GED Tessi Data Content, REST API integration.

Requirements

  • PHP >= 8.0
  • Symfony >= 6.4 (for Symfony 5.4, see previous releases)

License Released under the Apache-2.0 license

Installation

The bundle is automatically enabled by Symfony Flex. If you don't use Flex, you'll need to enable it manually.

composer require republique-et-canton-de-geneve/php-symfony-data-content-bundle

Configuration

Define the bundle configuration in your YAML files (e.g., config/packages/datacontent.yml):

data_content:
    checkSSL: true          # Enable SSL certificate/host verification
    applicationId: myAppli  # Application identifier
    tenantId: admin         # Tenant ID
    clientId: clientId      # GED client ID
    clientSecret: '%env(DATA_CONTENT_CLIENT_SECRET)%'  # GED client secret
    restUrl: 'https://ged.example.com'  # GED REST API URL
    baseId: baseId          # Base ID for the document database
    timeout: 20             # Connection timeout in seconds

    # Authentication parameters (Password Grant)
    username: 'User'                    # Username for token authentication
    password: '%env(DATA_CONTENT_PASSWORD)%'  # Password for token authentication
    audience: 'my-audience'             # OAuth audience for token request
    tokenAuthSsoUrl: 'https://sso.example.com'  # SSO/OAuth token URL
    tokenTimeout: 15                    # Token request timeout in seconds

Configuration Reference

Parameter Type Required Default Description
checkSSL bool No true Enable SSL certificate and host verification
applicationId string Yes — Application identifier
tenantId string No 'admin' Tenant identifier
clientId string No — Client ID for token authentication
clientSecret string No — Client secret for token authentication
restUrl string Yes — GED REST API base URL
baseId string Yes — Document database base ID
timeout int No 10 HTTP connection timeout in seconds
username string No — Username for OAuth password grant
password string No — Password for OAuth password grant
audience string No — OAuth audience for token request
tokenTimeout int No 10 Token request timeout in seconds
tokenAuthSsoUrl string No — OAuth/SAML token endpoint URL

Usage

Basic Usage

use EtatGeneve\DataContentBundle\Service\DataContent;

// Inject the DataContent service
public function __construct(
    private DataContent $dataContent,
) {
}

// Search documents
$results = $this->dataContent->searchByQuery(
    'DOCUMENT_TYPE:quotidienne',
    ['pageSize' => 100, 'searchLimit' => 1000],
    30
);

// Get document metadata by UUID
$metadata = $this->dataContent->searchByUuid('document-uuid-123');

// Download document content as binary string
$content = $this->dataContent->getDocument('document-uuid-123', httpResponse: false);

// Download document with Symfony Response (headers + download)
$response = $this->dataContent->getDocument('document-uuid-123', httpResponse: true);

// Store a new document
$this->dataContent->storeDocument(
    '/path/to/file.pdf',
    title: 'My Document',
    criterions: [
        ['categoryName' => 'METIER_DATE', 'wordValue' => '20231124', 'wordType' => 'String']
    ],
    options: ['filename' => 'my-file.pdf', 'extension' => 'pdf', 'documentType' => '10A_SUPPRESSION']
);

// Delete a document
$this->dataContent->deleteDocument('document-uuid-123');

Authentication

The bundle supports OAuth grant type:

  • password : Uses username/password credentials for token acquisition.

Exceptions

Exception Description
DataContentConfigException Missing required configuration parameters
DataContentAuthenticationException Token authentication/refresh failed
DataContentNotFoundException Document not found
DataContentJsonException Invalid JSON payload
DataContentRemoteException HTTP/network error

Quality gate

Code coverage : coverage line coverage branche

phpunit php8.4 phpstan rector php-cs-fixer

Tool Description
PHPUnit 13 Unit and integration tests
PHPStan Static analysis
PHP CS Fixer Code style consistency
Rector 2.6 Automated code modernization