Download the PHP package sofascore/purgatory without Composer

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

Purgatory

Purgatory is an extension which makes it possible for Symfony applications to handle enormous load using minimal infrastructure. Infrastructure meant to be used with this bundle along with Symfony application is a HTTP caching reverse proxy.

This bundle implements an easy and maintainable way to invalidate cache on endpoints based on changes in Doctrine entities.

Installation

Prerequisite - doctrine/orm

composer require sofascore/purgatory-bundle

Setup - Symfony reverse proxy

Enable Symfony Http Cache component in config/packages/framework.yaml

Wrap the default kernel into HttpCache caching kernel public/index.php

Define implementation of PurgerInterface and host to purge in config/packages/purgatory

Usage

Suppose you have a simple entity and controller.

When a request is sent to an endpoint for first time, reverse proxy saves the response and serves the same response until it expires (1 hour in this example). If the state of an entity changes in the meantime, content on the website stays the same until cache expires.

Purgatory has an annotation which defines rules for cache invalidation when a state of an object changes.

PurgeOn annotation

Parameters:

Workflow

When property of Post entity is changed and flushed to a database, Purgatory goes through PurgeOn annotations where changed property is in list of properties, checks the if expression, injects the parameters and purges the route.

Custom Purger

If you have a more complex setup or use varnish (recommended) you should implement your own purger that will be aware of your infrastructure.

Example purger:

You must also register that Purger with the configuration:

Add purge capability to varnish

That's it!

Examples

Endpoint which fetches all properties of a single post.

Use PurgeOn with FQCN and map route parameters with property of an entity. On change of any property of a Post, endpoint with entity id injected as route parameter postId gets invalidated.

Endpoint which fetches all featured Posts.

Use PurgeOn and specify a single property - cache invalidation happens every time property featured changes on any of the Posts.

Endpoint which fetches a list of all popular posts with more than 3000 upvotes.

Use PurgeOn with a condition - cache invalidation happens every time property upvotes on a Post with more than 3000 upvotes changes.

Debugging


Purgatory debug command groups all defined purging rules and dumps it on the screen. Its argument is an entity name or entity and property.

Command with defined entity and property dumps all routes which get refreshed by change of that property.

Observe that change of upvotes causes a cache invalidation on popular posts route as well as on post details route.


All versions of purgatory with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
doctrine/annotations Version ^1.13 || ^2
doctrine/doctrine-bundle Version ^2.1
doctrine/orm Version ^2.8
symfony/config Version ^5.4 || ^6.2
symfony/console Version ^5.4 || ^6.2
symfony/dependency-injection Version ^5.4 || ^6.2
symfony/expression-language Version ^5.4 || ^6.2
symfony/http-kernel Version ^5.4 || ^6.2
symfony/property-access Version ^5.4 || ^6.2
symfony/routing Version ^5.4 || ^6.2
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 sofascore/purgatory contains the following files

Loading the files please wait ....