Skip to content

Repository files navigation

php-europass

Generate Europass Candidate XML from structured CV data with PHP 8.1 or later. Use it as a library or a command-line tool, then embed the XML in your own PDF. It needs the DOM extension and makes no network requests.

This is the exporter used by my CV. It creates the structured attachment; your PDF generator controls the visible layout.

Install

Install the package from Packagist:

composer require diogocomposer/php-europass

For a source checkout:

git clone https://github.com/diogogithub/php-europass.git
cd php-europass
composer install

Use it in PHP

<?php

use Diogo\Europass\CandidateXml;

require 'vendor/autoload.php';

$person = [
    'given_name' => 'Alex',
    'family_name' => 'Example',
    'email' => '[email protected]',
];

$sections = [
    [
        'slug' => 'experience',
        'title' => 'Experience',
        'items' => [
            [
                'title' => 'Software engineer',
                'subtitle' => 'Example Engineering',
                'date_label' => '2021-present',
                'html' => '<p>Built a C++ analysis tool and documented its data format.</p>',
            ],
        ],
    ],
];

$xml = (new CandidateXml())->generate($person, $sections, 'Software engineering');
file_put_contents('attachment.xml', $xml);

generate() returns a UTF-8 XML string. It does not write files, render a PDF or import an existing CV. See the input reference for education, projects, additional sections, references and optional contact details.

The complete PHP example reads the included JSON fixture and writes XML to stdout:

php examples/generate.php > attachment.xml

Use the command

From a source checkout, no Composer installation is needed to run the command:

php bin/europass examples/cv.json attachment.xml

When installed as a Composer dependency:

vendor/bin/europass input.json attachment.xml

The command refuses to overwrite an existing file. --help prints its usage. Input or output errors return exit code 1; missing arguments return exit code 2.

Embed it in LaTeX

Load hyperref and embedfile in the preamble, then add this after \begin{document}:

\embedfile[
  filespec=attachment.xml,
  mimetype=application/xml,
  desc={Europass Candidate XML}
]{attachment.xml}

The PDF keeps its page layout and gains an embedded XML file. The LaTeX guide includes a working example, pdfLaTeX and LuaLaTeX commands, and attachment verification with pdfdetach.

Use the same selected records for the visible CV and its XML. Anyone who receives the PDF can extract the attachment, even if its contents are not visible on a page.

Compatibility

The output uses the Europass Candidate vocabulary, not the older SkillsPassport format. Full-CV imports were checked in both the Europass CV editor and profile wizard. The exporter handles the institution-name, description-markup and custom-section restrictions found during those checks.

This is not formal XSD certification or a guarantee of compatibility with every applicant tracking system. Review the imported records. The compatibility notes explain the tested behaviour and remaining limits.

Development

composer install
composer check
composer format

composer check validates package metadata, runs the tests and checks PHP formatting. composer format applies the formatting rules. With TeX and Poppler installed, composer test:latex checks the PDF attachment example.

See Contributing and the documentation index.

Licence

MIT. See LICENSE.

About

PHP library and CLI for generating Europass Candidate XML from CV data, with examples for embedding it in LaTeX PDFs.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages