Download the PHP package openeuropa/epoetry-client without Composer

On this page you can find all versions of the php package openeuropa/epoetry-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package epoetry-client

ePoetry PHP client

PHP client for the ePoetry service.

Before proceeding, it is recommended to read the "Introduction and terminology" section of the official ePoetry documentation.

A bird's-eye overview of a typical translation request workflow can be outlined as follows:

This project provides the necessary code (SOAP objects, middleware, etc.) to request a translation and handle incoming notifications from the ePoetry service.

Versions

Project overview

Authentication

The ePoetry service uses EU Login as a trusted third-party authentication system. Application that wants to use the ePoetry client will need to request an EU Login Job Account.

You can request an EU Login job account from DIGIT by visiting this page and communicate it to DGT for setting up access. When requesting your job account, please keep in mind that:

Note: when requesting your job account make sure to ask DIGIT to insert your DG in the job account's "department" field: this is required by the ePoetry service.

Once you get your job account, you have two ways of authenticating against the service:

PLEASE NOTE: both methods above requires extra dependencies to be added to your project, please check the respective sections below for more information.

Authenticating via Client Certificate login

In EU Login, the application running the ePoetry library (e.g. a Drupal site) can be represented by a special kind of user accounts called a "job account".

In order to set up this authentication method you need to request a job account to EU Login, linked to the site running the ePoetry library. You can ask your direct manager or scrum master to initiate the request job account request. Check this page for more information.

After getting an EU Login job account you need to communicate this to DGT so that they can proceed with the setup on the ePoetry service. For more information about this procedure check this page.

Once you get the job account you need to request a client certificate: you can ask this too to your scum master. On acceptance environments you can request one yourself at https://webgate.acceptance.ec.europa.eu/cas/selfCertWeb.

Once you receive the actual client certificate file, in .p12 format, and its password, you can configure the authentication plugin service. Below an example of a possible setup:

For ePoetry acceptance, use the following:

PLEASE NOTE: this authentication method requires the following dependencies, as specified in composer.json "suggest" section:

Authenticating via OpenID Connect

You can authenticate using OpenID Connect by using the OpenIDAuthentication plugin.

This authentication plugin needs the following parameters to be set:

In order to obtain this you need to register your application as an OpenID Connect client by following these instructions.

Below you can find a working example of a client metadata:

Use the above values as a reference to configure your own client metadata. Make sure you set these as follows:

Once you get such information, store it in a JSON file that is reachable by your application, as this will be needed to configure the authentication service. Below an example of a possible setup:

For ePoetry acceptance, use the following:

PLEASE NOTE: this authentication method requires the following dependencies, as specified in composer.json "suggest" section:

ePoetry Notifications

The ePoetry service sends messages to the site, containing information about a translation request status change, the translated content, etc.

In order for your application to be able to receive and handle ePoetry notifications, you need to expose two endpoints:

The NotificationServerFactory can be used in implementing both endpoints.

The NotificationServerFactory service requires the following dependencies:

Below an example of a Symfony controller that implements both endpoints:

In the example above, the NotificationServerFactory's $callback would be: https://my-site.com/translation.

When handling inbound notifications, the NotificationServerFactory fires the following Symfony events:

For more information about ePoetry notifications check the official documentation.

Authenticate inbound notifications

Inbound notifications will need to be authenticated using the EU Login ticket validation service. In order to do so, this library provides the EuLoginTicketValidation service, which will need to be injected when building the NotificationServerFactory.

The EuLoginTicketValidation service requires the following dependencies:

Below an example of a possible setup:

Generate SOAP-related classes

The library is built using the PHP SOAP client project which, among other things, allows for SOAP-related PHP classes to be automatically generated, given a WSDL/XSD files pair.

To (re-)generate code, run:

Or, simply, the command below, which runs all three commands above:

Note that the method \OpenEuropa\EPoetry\Notification\Type\RequestReference::getReference() has been added manually, and it won't be automatically generated: make sure you restore it using your local Git history.

Interact with the service via command line

This library provides the following convenience CLI commands to interact with the ePoetry service. You can set command verbosity by setting the usual -v, -vv and -vvv flags. If you want to set the maximum level of verbosity, set EPOETRY_CONSOLE_DEBUG=1 in .env. You can also copy .env into .env.local and override the value there: .env.local is git-ignored by default.

Note for developers: Symfony stores a compiled version of the command container under ./var: make sure you delete this directory if you:

Get an authentication token from EU Login

Run:

This will use the authentication method set in the Symfony Console container to retrieve an authentication ticket. If successful the ticket will be printed out:

The default authentication method is the Client Certificate login, you can change that to the OpenID Connect plugin by setting an alternative value here in ./config/console/services.yml:

The Client Certificate method requires a path to the client certificate file, in .p12 format, and it's password. Both parameters can be set via the following environment variables:

The OpenID Connect method requires a valid client metadata JSON file, available locally. You can control the value of that, along with other authentication setting, by changing the following environment variables:

Perform a request by evaluating PHP code

Run:

The PHP file /path/to/request.php should return a function with the following signature:

The command will require the file above and use the returned valued to perform an actual request to the ePoetry service. You can set the desired service URL via the following environment variable:

If successful the command will return the ePoetry response in JSON format:

Running the command with -vvv will display the raw HTTP request and response.

Receive notification from the ePoetry service

Run:

This will start a service listening for incoming messages at port 8088.

All POST incoming requests will be saved in .sink/notifications, regardless if they are actual ePoetry notifications, or not. Additionally, ePoetry notifications will be handled and the service response will be print out on the console.

Any GET request to your service will print out the service WSDL, which contains the callback URL. When running this on a publicly accessible server, you might want to change the callback URL by setting the following ENV variable:

Remember to delete the ./var directory to force a Symfony command container rebuild.

You can override the command default parameters as follows:

If you wish to return an error, start the service with the -e flag.

It is recommended to always use -vvv for a fully verbose output.

Using it on a European Commission Cloud9 environment

When using the console commands on a Cloud9 environment, add a docker-compose.override.yml with the following content:

Then login into the php container and run:

This is necessary until the official Docker image will support the required PHP extension.

Using it on a European Commission site

The ePoetry client library requires the ext-bcmath PHP extension, which is not necessarily enabled on all images used on the European Commission infrastructure.

When using this library on a site, make sure you install the ext-bcmath extension by specifying it in the site's .opts.yml file, as follows:

For more information please refer to the pipeline configuration documentation.

Known issues

The updateCallbackUrl method is incorrectly specified in the ePoetry schema, for this reason we have patched locally the schema in this PR. If necessary, remember to reapply such change after updating the WSDL/XSD files.


All versions of epoetry-client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.21
ext-curl Version *
ext-dom Version *
ext-soap Version *
ext-xsl Version *
cweagans/composer-patches Version ^1 || ^2
php-http/logger-plugin Version ^1
php-http/message Version ~1.13
phpro/soap-client Version ~2.4
psr/http-client Version ^1
psr/http-client-implementation Version *
psr/http-factory Version ^1
psr/http-factory-implementation Version *
psr/log Version ^2 || ^3
symfony/http-client Version ~5.4 || ~6
symfony/serializer Version ~5.4 || ~6
symfony/validator Version ~5.4 || ~6
veewee/xml Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package openeuropa/epoetry-client contains the following files

Loading the files please wait ....