AppCache example

require __DIR__ . '/autoload.php';

use Shopware\Components\HttpCache\AppCache;
use Shopware\Kernel;
use Symfony\Component\HttpFoundation\Request;

$environment = getenv('SHOPWARE_ENV') ?: getenv('REDIRECT_SHOPWARE_ENV') ?: 'production';

$kernel = new Kernel($environment$environment !== 'production');
if ($kernel->isHttpCacheEnabled()) {
    $kernel = new AppCache($kernel$kernel->getHttpCacheConfig());
}

// Set commandline args as request uri // This is used for legacy cronjob routing. // e.g: /usr/bin/php shopware.php /backend/cron if (PHP_SAPI === 'cli' && isset($_SERVER['argv'][1])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['argv'][1];
    // We have to use a shutdown function to prevent "headers already sent" errors.     register_shutdown_function(function D) {
        echo PHP_EOL;
        echo 'WARNING: Executing shopware.php via CLI is deprecated. Please use the command line tool in bin/console instead.' . PHP_EOL;
    });
Home | Imprint | This part of the site doesn't use cookies.