PHPackages                             bigfork/silverstripe-share-care-fork - 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. bigfork/silverstripe-share-care-fork

ActiveSilverstripe-vendormodule

bigfork/silverstripe-share-care-fork
====================================

Social media sharing previews and customisation for Silverstripe

1.0.0(9mo ago)0153↓33.3%1[1 PRs](https://github.com/bigfork/silverstripe-share-care-fork/pulls)BSD-3-ClausePHP

Since Aug 20Pushed 9mo agoCompare

[ Source](https://github.com/bigfork/silverstripe-share-care-fork)[ Packagist](https://packagist.org/packages/bigfork/silverstripe-share-care-fork)[ RSS](/packages/bigfork-silverstripe-share-care-fork/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

⚠️ This is a fork ⚠️
====================

[](#️-this-is-a-fork-️)

This is a Bigfork-maintained fork of [jonom/silverstripe-share-care](http://github.com/jonom/silverstripe-share-care) and so may contain opinionated changes.

Share Care for Silverstripe
===========================

[](#share-care-for-silverstripe)

When URLs are shared on social media a rich preview of the content may be generated to give the URL context. The goal of this module is to encourage CMS users to be aware of how their content will appear when shared, and give them tools to customise this appearance.

[![CMS Preview Example](screenshots/share-care-cms.png)](screenshots/share-care-cms.png)

Requirements
------------

[](#requirements)

- Silverstripe ^4 | ^5
- [Silverstripe Opengraph module](https://github.com/tractorcow/silverstripe-opengraph)

Installation
------------

[](#installation)

See the [Packagist listing](https://packagist.org/packages/jonom/silverstripe-share-care) and [composer installation instructions](http://doc.silverstripe.org/framework/en/installation/composer#adding-modules-to-your-project).

1. `$ composer require jonom/silverstripe-share-care`
2. Flush manifests by visiting /dev/build

How to use
----------

[](#how-to-use)

### View rich share previews in the CMS

[](#view-rich-share-previews-in-the-cms)

With the module installed you should find a Share tab on all pages which shows you roughly what each page will look like when shared on social media. The preview is based upon the output of the Opengraph module, so your configuration of that module will be reflected here.

To add share previews to other DataObject classes, just add the `ShareCare` extension to them. Example:

```
---
Name: mysharecare
After: 'opengraphextensions'
---
MyDataObject:
  extensions:
    - JonoM\ShareCare\ShareCare
```

See the [Silverstripe documentation](https://docs.silverstripe.org/en/developer_guides/extending/extensions/) for more info on extensions.

### Customise the appearance of content on social media

[](#customise-the-appearance-of-content-on-social-media)

You can configure the Opengraph module to generate open graph tags however you like, and this is what controls the appearance of rich previews on social media (especially Facebook and Twitter). To quickly configure the Opengraph module to allow CMS users to customise the content and appearance of these previews, just add the `ShareCareFields` extension to your Page class (and any other classes you like).

[![Field example](screenshots/share-care-fields.png)](screenshots/share-care-fields.png)

Example configuration:

```
---
Name: mysharecare
After: 'opengraphextensions'
---
Page:
  extensions:
    - JonoM\ShareCare\ShareCareFields
```

This allows CMS users to customise the image, title and description that are shown when a URL is shared on social media. You can further tweak these behaviours by overriding functions on your classes. For example if each page on your website already contains a Hero Image, you may want to override `getDefaultOGImage()` to use this as the default image:

```
/**
 * Provide a better default OG image for pages
 */
public function getDefaultOGImage() {
	// Use hero image if available
	if ($this->HeroImageID) {
		return $this->HeroImage();
	}
	// Fallback to website's apple-touch-icon
	if (file_exists(BASE_PATH . '/apple-touch-icon.png')) {
		return Director::absoluteURL('apple-touch-icon.png', true);
	}
}
```

*Note that `og:image` is a [required property](http://ogp.me/), so please ensure that `getDefaultOGImage()` will always work. If your website includes an apple-touch-icon.png file in the root you'll be covered.*

#### Don't need that much control?

[](#dont-need-that-much-control)

As an alternative to the `ShareCareFields` extension, try taking the `ShareCareSingleSummary` extension for a spin. This opinionated extension lets CMS users choose a single image and a single summary to be used to represent a page within the website and on search engines and social media. It puts the fields front and centre above the main content field to encourage CMS users to actually fill them out. As a bonus it also hides that pesky 'custom meta tags' field away in the Settings tab.

[![Summary fields](screenshots/share-care-summary-fields.png)](screenshots/share-care-summary-fields.png)

Example configuration:

```
---
Name: mysharecare
After: 'opengraphextensions'
---
Page:
  extensions:
    - JonoM\ShareCare\ShareCareSingleSummary
```

### Twitter integration

[](#twitter-integration)

Markup for a [large image summary](https://dev.twitter.com/cards/types/summary-large-image)Twitter card will be included if a large enough image is provided. To attribute content ownership set a Twitter username in your config.yml file. Example:

```
JonoM\ShareCare\ShareCare:
  twitter_username: 'your-username'
```

Don't want Twitter card markup? Disable it like so:

```
JonoM\ShareCare\ShareCare:
  twitter: false
```

Note that Twitter will still use your open graph tags to produce a rich preview if this feature is disabled.

### Control Facebook's Cache

[](#control-facebooks-cache)

Out of the box, this module will attempt to clear Facebook's knowledge of your site or app, after every page write. You will probably need a Facebook access token for this functionality to work (it used to be optional but now seems to be required).

See the [facebook access token docs entry](docs/en/facebook-access-token.md) for instructions on obtaining and using the token.

#### Opt out of Facebook cache clearing

[](#opt-out-of-facebook-cache-clearing)

You can opt out through the config system or object methods.

Use the following config to only attempt to purge the Facebook cache on live environments.

```
JonoM\ShareCare\ShareCare:
  enable_facebook_cache_clear: false
---
Only:
  environment:
    - live
---
JonoM\ShareCare\ShareCare:
  enable_facebook_cache_clear: true
```

If you need more control you can provide a `doClearFacebookCache()` method on your `Page` or `DataObject` class to return `true` or `false` as necessary. You may want to return the value of `Config::inst()->get('JonoM\ShareCare\ShareCare', 'enable_facebook_cache_clear')` as a fallback.

### Share links

[](#share-links)

You can use these methods in your templates to get a convenient share URL for each service

- `$FacebookShareLink`
- `$TwitterShareLink`
- `$PinterestShareLink`
- `$LinkedInShareLink`
- `$EmailShareLink`

#### Pinterest CMS integration

[](#pinterest-cms-integration)

If you're making use of the `ShareCareFields` extension and $PinterestShareLink, you can include a Pinterest preview in the CMS and allow CMS users to set a different image for Pinterest, as tall rather than wide images are better suited to this service.

```
JonoM\ShareCare\ShareCare:
  pinterest: true
```

Maintainer contact
------------------

[](#maintainer-contact)

[Jono Menz](https://jonomenz.com)

Sponsorship
-----------

[](#sponsorship)

If you want to boost morale of the maintainer you're welcome to make a small monthly donation through [**GitHub**](https://github.com/sponsors/jonom), or a one time donation through [**PayPal**](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z5HEZREZSKA6A). ❤️ Thank you!

Please also feel free to [get in touch](https://jonomenz.com) if you want to hire the maintainer to develop a new feature, or discuss another opportunity.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance58

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

271d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/203294386?v=4)[-&gt; lozcalver](/maintainers/kinglozzer)[@kinglozzer](https://github.com/kinglozzer)

---

Top Contributors

[![lozcalver](https://avatars.githubusercontent.com/u/1655548?v=4)](https://github.com/lozcalver "lozcalver (1 commits)")

---

Tags

facebooksilverstripesharesocial mediaopengraphopen-graph

### Embed Badge

![Health badge](/badges/bigfork-silverstripe-share-care-fork/health.svg)

```
[![Health](https://phpackages.com/badges/bigfork-silverstripe-share-care-fork/health.svg)](https://phpackages.com/packages/bigfork-silverstripe-share-care-fork)
```

###  Alternatives

[jonom/silverstripe-share-care

Social media sharing previews and customisation for Silverstripe

2932.7k1](/packages/jonom-silverstripe-share-care)[social-links/social-links

PHP library to generate share buttons

112338.6k2](/packages/social-links-social-links)[tractorcow/silverstripe-opengraph

Implementation of the Facebook Open Graph protocol for SilverStripe

52141.6k5](/packages/tractorcow-silverstripe-opengraph)[quinninteractive/silverstripe-seo

An all-in-one SEO module for SilverStripe

3328.2k](/packages/quinninteractive-silverstripe-seo)[umanskyi31/opengraph

Created a new component for Yii2. The Open Graph component for your website

119.7k](/packages/umanskyi31-opengraph)

PHPackages © 2026

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