PHP code example of locomotivemtl / charcoal-contrib-command

1. Go to this page and download the library: Download locomotivemtl/charcoal-contrib-command library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

locomotivemtl / charcoal-contrib-command example snippets



namespace Charcoal\Cache\Command;

[...]

/**
 * Cache clearer command
 */
class ClearCommand extends AbstractCommand
{
    use CachePoolAwareTrait;

    /**
     * @param array $arguments
     */
    public function setDependencies(Container $container)
    {
        parent::setDependencies($container);
        $this->setCachePool($container['cache']);
    }

    /**
     * @return mixed|void
     */
    public function execute()
    {
        $success = $this->cachePool()->clear();
        $this->setSuccess($success);
    }
}

    $stack = $container['command/queue-stack'];
    $stack->enqueue([
        'command' => 'charcoal/cache/command/clear',
        'processingDate' => 'NOW +1 day'
    ]);

public QueueStack::enqueue ( array $data ) : QueueStack