承接 bigfork/silverstripe-share-care-fork 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bigfork/silverstripe-share-care-fork

Composer 安装命令:

composer require bigfork/silverstripe-share-care-fork

包简介

Social media sharing previews and customisation for Silverstripe

README 文档

README

This is a Bigfork-maintained fork of jonom/silverstripe-share-care and so may contain opinionated changes.

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

Requirements

Installation

See the Packagist listing and composer installation instructions.

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

How to use

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 for more info on extensions.

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

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, 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?

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

Example configuration:

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

Twitter integration

Markup for a large image summary 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

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 for instructions on obtaining and using the token.

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

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

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

Jono Menz

Sponsorship

If you want to boost morale of the maintainer you're welcome to make a small monthly donation through GitHub, or a one time donation through PayPal. ❤️ Thank you!

Please also feel free to get in touch if you want to hire the maintainer to develop a new feature, or discuss another opportunity.

bigfork/silverstripe-share-care-fork 适用场景与选型建议

bigfork/silverstripe-share-care-fork 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 186 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「facebook」 「opengraph」 「open graph」 「silverstripe」 「social media」 「share」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 bigfork/silverstripe-share-care-fork 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bigfork/silverstripe-share-care-fork 我们能提供哪些服务?
定制开发 / 二次开发

基于 bigfork/silverstripe-share-care-fork 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 186
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 28
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-08-20