germania-kg/clearcache-command

PHP Package boilerplate

1.1.0 2023-01-04 14:34 UTC

This package is auto-updated.

Last update: 2024-11-04 18:34:15 UTC


README

Symfony Console Command for clearing caches in our web apps.

[![Tests](https://github.com/GermaniaKG/ClearCacheCommand/actions/workflows/tests.yml/badge.svg)](https://github.com/GermaniaKG/ClearCacheCommand/actions/workflows/tests.yml)

Installation

$ composer require germania-kg/clearcache-command:^1.0

Requirements

This package requires the Symfony Console component and the Psr\Cache interfaces.

Usage

The ClearCacheCommand clears app cache directories and PSR Cache Item Pools:

use Germania\ClearCache\ClearCacheCommand;

$directories = array();
$psr_cacheitempools = array();

$cmd = new ClearCacheCommand($directories, $psr_cacheitempools);

CLI usage

The command name is cache:clear, and it accepts a --dry-run option:

$ bin/console cache:clear
$ bin/console cache:clear --dry-run

Development

$ git clone git@github.com:GermaniaKG/ClearCacheCommand.git
# or
$ git clone https://github.com/GermaniaKG/ClearCacheCommand.git

Unit tests and development

  1. Copy phpunit.xml.dist to phpunit.xml
  2. Run PhpUnit like this:
$ composer test
# or
$ vendor/bin/phpunit

And there's more in the scripts section of composer.json.