PHPackages                             bnomei/kirby3-janitor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. bnomei/kirby3-janitor

ActiveKirby-plugin[CLI &amp; Console](/categories/cli)

bnomei/kirby3-janitor
=====================

Kirby Plugin for running commands like cleaning the cache from within the Panel, PHP code or a cronjob

5.4.3(8mo ago)9339.9k↓13.8%10[1 issues](https://github.com/bnomei/kirby-janitor/issues)2MITPHPPHP &gt;=8.2CI failing

Since Dec 8Pushed 8mo ago4 watchersCompare

[ Source](https://github.com/bnomei/kirby-janitor)[ Packagist](https://packagist.org/packages/bnomei/kirby3-janitor)[ Docs](https://github.com/bnomei/kirby-janitor)[ RSS](/packages/bnomei-kirby3-janitor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (123)Used By (2)

Kirby Janitor
=============

[](#kirby-janitor)

[![Kirby 5](https://camo.githubusercontent.com/b1a1b2ccd58e96259a9722c2489d91f40378c01b6c4c3e9fd27ed1d12c269d7c/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f4b697262792f353f636f6c6f723d454343373438)](https://getkirby.com)[![PHP 8.2](https://camo.githubusercontent.com/fd050028b4459f3f6e4db5703412957375ceb180d27951213d421eb2a23c8c8e/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f5048502f382e323f636f6c6f723d3445354239332669636f6e3d706870266c6162656c)](https://camo.githubusercontent.com/fd050028b4459f3f6e4db5703412957375ceb180d27951213d421eb2a23c8c8e/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f5048502f382e323f636f6c6f723d3445354239332669636f6e3d706870266c6162656c)[![Release](https://camo.githubusercontent.com/8652417a18aa1ad821bd7da26f89ff9f5b3300d733d20e9d52068f1d7246998a/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b697262792d6a616e69746f723f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)](https://camo.githubusercontent.com/8652417a18aa1ad821bd7da26f89ff9f5b3300d733d20e9d52068f1d7246998a/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b697262792d6a616e69746f723f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)[![Discord](https://camo.githubusercontent.com/36eaef1b06f4996feb7587aa3281dcbd658e57535bc6b5e10110ed108e7a7a03/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f646973636f72642f626e6f6d65693f636f6c6f723d3732383964612669636f6e3d646973636f7264266c6162656c)](https://discordapp.com/users/bnomei)[![Buymecoffee](https://camo.githubusercontent.com/62e55d1129b82bf9c2fd4656451e81ab87a9787e7c9676ca58276532ed9666ee/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f69636f6e2f646f6e6174653f69636f6e3d6275796d6561636f6666656526636f6c6f723d464638313346266c6162656c)](https://www.buymeacoffee.com/bnomei)

Janitor is a Kirby CMS Plugin for running commands.

- It is a Panel Button!
- It has commands built-in for cleaning the cache, sessions, create zip-backup, pre-generate thumbs, open URLs, refresh the current Panel page and more.
- You can define your own commands (call API hooks, play a game, hack a server, ...)
- It can be triggered in your frontend code, with the official kirby CLI and a CRON.

Install
-------

[](#install)

You have to use composer to install both the plugin and the CLI locally into your project:

```
composer require getkirby/cli bnomei/kirby-janitor
```

Warning

You need to install the CLI with composer into your project and not use the global version. Since Janitor depends on the CLI to be available, installing only the janitor plugin via submodules or via ZIP is NOT supported.

Setup
-----

[](#setup)

### CLI Command

[](#cli-command)

In any blueprint create a janitor field with your command, browse to that page in panel and press the button.

**site/blueprints/page/default.yml**

```
title: Default Page
fields:
  call_my_command:
    type: janitor
    command: 'example --data test'
    label: Call `Example` Command
```

Janitor will automatically fill in the current model.

- The `--model` argument will have the UUID or ID of the current model. You can use `janitor()->model($cli->arg('model'))` to get the object.
- But if for example you press the panel button on a page you will have `--page` argument set to the UUID or ID of that page. Use `$cli->kirby()->page($cli->arg('page'))` to get the object.
- If you call it on a file view then `--file` arg will be set. Use `$cli->kirby()->file($cli->arg('file'))` to get the object.
- On a panel user view... `--user`. Use `$cli->kirby()->user($cli->arg('user'))` to get the object.
- And lastly `--site` (boolean) will be automatically set when you had the button in the `site/blueprints/site.yml` blueprint. `if($cli->arg('site')) { $cli->kirby()->site(); }`

Create a Kirby CLI command [via a custom plugin](https://getkirby.com/docs/reference/plugins/extensions/commands) or put them into `site/commands`.

**site/commands/example.php**

```
