Download the PHP package wedevelopnl/silverstripe-fpc-purge without Composer

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

silverstripe-fpc-purge

This module adds some cache purging capabilities to the website, to support FPC in nginx or apache.

Requirements

Installation

Configuring nginx

Install the latest version of ngx_cache_purge.

Then update your server configuration:

NOTE: Consider randomizing or otherwise protecting your URL to prevent abuse.

Configuring the module

Here you can enable the module and configure the endpoint used to purge.

You can test this configuration by going into the SilverStripe admin, then click FPC Purge in the sidebar and click the Purge Cache button. It should tell you if it was successful.

We also add an extension to Page to purge the cache after publishing a page.

NOTE: The purge after publishing opens a connection, then sends a non-blocking request, should have little to no impact on publishing performance depending on the endpoints.

If you're using dnadesign/silverstripe-elemental don't forget to also apply the extension on BaseElement to make sure cache is purged after publishing an element.

Setting up Cache Control

All of the above will not cache anything until you setup cache control. You can either follow the official SilverStripe docs, or use the extension included in this module for an easier foolproof implementation.

Now you have to add a updateCacheControl() method to your PageController and configure the CacheControl headers.

Shared Max Age: the amount of time in seconds this page is allowed to be cached in your FPC (nginx, apache, etc.) \ Max Age: the amount of time in seconds this page is allowed to be cached in the browser

If you have another controller that extends the PageController but serves more dynamic data from an API for example, you can override the CacheControl headers in that controller by overriding the updateCacheControl method.

Here we set the max age to 0 to prevent it from being cached by the browser, and a relatively low shared max age. This way cache can only be stale for 10 minutes.

Sessions and CSRF tokens

It's important not to cache pages that are generated within the context of a session, for example a logged in user or a CSRF token. Luckily, there are two things protecting us from this mistake.

  1. SilverStripe will overrule our cache control headers when a session is active.
  2. The nginx configuration triggers a bypass when a PHPSESSID is found.

Default configuration

License

See License

Maintainers

Development and contribution

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. See read our contributing document for more information.

Getting started

We advise to use Docker/Docker compose for development.\ We also included a Makefile to simplify some commands

Our development container contains some built-in tools like PHPCSFixer.

Getting development container up

make build to build the Docker container and then run detached.\ If you want to only get the container up, you can simply type make up.

You can SSH into the container using make sh.

All make commands

You can run make help to get a list with all available make commands.


All versions of silverstripe-fpc-purge with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
silverstripe/cms Version ^4.6.0@stable
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 wedevelopnl/silverstripe-fpc-purge contains the following files

Loading the files please wait ....