Download the PHP package somardigital/silverstripe-cloudfront without Composer

On this page you can find all versions of the php package somardigital/silverstripe-cloudfront. 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 silverstripe-cloudfront

Silverstripe CloudFront

Invalidate CloudFront cache when pages and files are published, unpublished, or deleted in Silverstripe CMS.

Problem Statement

When editors publish, unpublish, or delete pages and files, the public-facing site does not update because CloudFront is still serving the old, cached version. This requires manual cache clearing, which is inefficient and error-prone.

Solution

This module provides:

When a page or file is published, unpublished, or deleted, the extension automatically sends invalidation requests to CloudFront. All operations are logged using PSR-3 LoggerInterface for proper observability.

Requirements

Installation

Via Composer (recommended)

Or for local development add this to composer.json:

Then run:

Manual Installation

  1. Clone this repository into your project
  2. Run composer install in your project root
  3. Run vendor/bin/sake dev/build flush=1

Usage

The extension is automatically applied to SiteTree and File classes via YAML configuration. No additional setup is required.

When an editor:

Configuration

AWS Credentials

Add the following to your .env file:

How It Works

  1. The extension hooks into Silverstripe's ORM events:

    • onAfterPublish
    • onAfterUnpublish
    • onAfterDelete
  2. When triggered, it retrieves the object's public URL:

    • For SiteTree: uses Link()
    • For File: uses Link()
  3. Sends two invalidation paths to CloudFront:

    • The exact path: /about-us
    • Wildcard path with query params: /about-us?*

    This ensures both the base page and all variations with query parameters are invalidated.

  4. If invalidation fails, it logs a warning but doesn't break the publish/delete process

CMS User Cache Bypass (Optional)

This module includes an optional feature to help CMS users bypass CloudFront cache by setting a cookie when they log in. This allows logged-in editors and admins to see the latest content immediately without waiting for cache invalidation.

Note: Setting the cookie alone does not bypass the cache. You must also configure a CloudFront Behavior to bypass caching when this cookie is present. See AWS CloudFront documentation for details on cookie-based cache behaviors.

Enabling the Feature

Add to your .env file:

Customizing the Configuration

You can customize the cookie name and required permission in your project's YAML configuration:

Default values:

How It Works

When CLOUDFRONT_CACHE_BYPASS_ENABLED=true:

  1. On Login: If the member has the required permission (default: CMS_ACCESS_CMSMain), the configured cookie is set in their browser
  2. On Logout: The cookie is cleared

This cookie can then be used in CloudFront to create a cache behavior that bypasses the cache for users with this cookie present.


All versions of silverstripe-cloudfront with dependencies

PHP Build Version
Package Version
Requires silverstripe/framework Version ^6
silverstripe/cms Version ^6
aws/aws-sdk-php Version ^3.379
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 somardigital/silverstripe-cloudfront contains the following files

Loading the files please wait ...