PHPackages                             heimrichhannot/contao-share - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. heimrichhannot/contao-share

ActiveContao-module[PDF &amp; Document Generation](/categories/documents)

heimrichhannot/contao-share
===========================

A helper module for pdf-print, print and social share functionality based on bootstrap to custom modules.

1.12.5(1y ago)01.0kLGPL-3.0-or-laterPHPPHP ~5.6 || ^7.1 || ^8.0

Since Apr 24Pushed 1y ago6 watchersCompare

[ Source](https://github.com/heimrichhannot/contao-share)[ Packagist](https://packagist.org/packages/heimrichhannot/contao-share)[ Docs](https://github.com/heimrichhannot/contao-share)[ RSS](/packages/heimrichhannot-contao-share/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (44)Used By (0)

Share
=====

[](#share)

A helper module for pdf-print, print and social share functionality based on bootstrap to custom modules.

Features
--------

[](#features)

- news &amp; calendar support
- add syndication to modules and articles
- syndication options:
    - print pdf
    - print by a custom module template or call the default browser print fun
    - ical-event
    - mailto
    - feedback
    - facebook share
    - twitter share
    - googleplus share

Usage
-----

[](#usage)

### Setup for modules

[](#setup-for-modules)

##### Add Share to your module palette

[](#add-share-to-your-module-palette)

Add `{share_legend},addShare;` to your model default palette.

Example:

```
$dca = &$GLOBALS['TL_DCA']['tl_module'];
$dca['palettes']['newsreader'] = str_replace(
    '{image_legend',
    '{share_legend},addShare;{image_legend',
    $dca['palettes']['newsreader']
);

```

##### Generate share output

[](#generate-share-output)

To show the share buttons in your module, you need to add the return of `Settings->generate()` to your template.

Example:

```
// Module class:

public function compile()
{
    ...
    $this->generateShare();
    ...
}

protected function generateShare()
{
    if ($this->addShare)
    {
        $objShare = new \HeimrichHannot\Share\Share($this->objModel, [Entity to print]);

        $this->template->share = $objShare->generate();
    }
    return null;
}

// Template file:

```

#### Add Share urls to your template

[](#add-share-urls-to-your-template)

```
// Add this to the generateShare method from above, after calling generate():
if ($this->module->share_addTemplateLinks)
{
    $this->template->shareUrls = $objShare->generateShareUrls();
}
```

This will add an array to the template with following key containing just the urls:

- mailto
- facebook
- twitter
- linkedin
- whatsapp

### Setup for articles

[](#setup-for-articles)

Since version 1.5 you can also print complete articles.

1. Setup a new model, which has share enabled (=has addShare added to the module palette, the module type doesn't matter). This module will hold the settings for the article.
2. Check "Add Syndication" on the article settings page and choose the module setup before.
3. Echo `$this->share` in your article template.

### Custom name for your pdf files

[](#custom-name-for-your-pdf-files)

Your module has to implement `ModulePdfReaderInterface`. The return-value of `getFileName()` is used as pdf file name. Don't add .pdf, it will be added by the module itself.

1

### Print page

[](#print-page)

To address your custom module print layout, the url must contain the `print` parameter with the module id as value. (Example: `?print=57`). The default print link will do that for you and will create a new tab/window and close it immediately after the window was printed by the user. To debug the print layout, add the `pDebug=1` parameter to your print url (Example: `?print=57&pDebug=1`).

For regions within your templates that should not be printable, add `\` before that region and `` afterwards.

```

DO NOT PRINT THIS!

```

It is also possible to simple call the browser print windows to print the complete page by checking 'printWithoutTemplate' withing the syndication selection in module settings.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~86 days

Recently: every ~185 days

Total

42

Last Release

523d ago

Major Versions

1.5.0 → v2.x-dev2018-01-17

PHP version history (5 changes)1.1.0PHP ~5.4 || ~7.0

v2.x-devPHP ~7.1

1.9.1PHP ~5.6 || ~7.0

1.10.0PHP ~5.6 || ~7.1

1.11.0PHP ~5.6 || ^7.1 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/28ad3224d8727b622ebd229840eea6b9dbcb83eb0bd609e6ce65b614830ff538?d=identicon)[digitales@heimrich-hannot.de](/maintainers/digitales@heimrich-hannot.de)

---

Top Contributors

[![koertho](https://avatars.githubusercontent.com/u/12064642?v=4)](https://github.com/koertho "koertho (44 commits)")[![vvohh](https://avatars.githubusercontent.com/u/75325799?v=4)](https://github.com/vvohh "vvohh (2 commits)")

---

Tags

pdffacebooktwittercontaosharegoogleplus

### Embed Badge

![Health badge](/badges/heimrichhannot-contao-share/health.svg)

```
[![Health](https://phpackages.com/badges/heimrichhannot-contao-share/health.svg)](https://phpackages.com/packages/heimrichhannot-contao-share)
```

###  Alternatives

[fritzmg/contao-sharebuttons

Simple Contao extension to provide share buttons as a module and content element

1832.5k](/packages/fritzmg-contao-sharebuttons)[social-links/social-links

PHP library to generate share buttons

112338.6k2](/packages/social-links-social-links)[pdir/social-feed-bundle

Social feed extension for Contao CMS

1414.8k](/packages/pdir-social-feed-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
