Skip to content

Instantly share code, notes, and snippets.

@stoll
Forked from MadMikeyB/INSTALL-SHOPWARE-SIX.md
Last active July 2, 2020 13:47
Show Gist options
  • Save stoll/f28aebb479caa5ab6e18a603b810e76b to your computer and use it in GitHub Desktop.
Save stoll/f28aebb479caa5ab6e18a603b810e76b to your computer and use it in GitHub Desktop.
Shopware 6 - Laravel Valet Driver

Shopware 6 - Laravel Valet Custom Driver

Serving Shopware 6 with nginx and Laravel Valet or Valet Plus.

Install

Follow the below commands:

cd ~/.valet/Drivers
nano ShopwareSixValetDriver.php
# Paste contents of `ShopwareSixValetDriver.php`
valet restart

Read More about Custom Valet Drivers

Install Shopware 6 (For Development)

cd ~/sites
valet park
# clone shopware
git clone -b 6.1 https://github.com/shopware/development.git shopware
# change directory
cd shopware
# install dependencies
composer install
# let valet know we're using shopware with a hidden file
touch .shopware-valet
# add to gitignore
echo '.shopware-valet' >> .gitignore
# install shopware
bin/setup
# now run installation wizard (40 steps, interactive shell)
# visit http://shopware.test

Install Shopware 6 (For Production)

cd ~/sites
valet park
# clone shopware
git clone -b 6.1 https://github.com/shopware/production shopware
# change directory
cd shopware
# install dependencies
composer install
# let valet know we're using shopware with a hidden file
touch .shopware-valet
# add to gitignore
echo '.shopware-valet' >> .gitignore
# install shopware
bin/console system:setup
bin/console system:install --create-database --basic-setup
<?php
/**
* Shopware 6 Laravel Valet Driver
* @author Michael Burton <[email protected]>
*/
class ShopwareSixValetDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return bool
*/
public function serves($sitePath, $siteName, $uri)
{
return file_exists($sitePath . '/.shopware-valet');
}
/**
* Determine if the incoming request is for a static file.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return string|false
*/
public function isStaticFile($sitePath, $siteName, $uri)
{
if (file_exists($staticFilePath = $sitePath.'/public/'.$uri)) {
return $staticFilePath;
}
return false;
}
/**
* Get the fully resolved path to the application's front controller.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return string
*/
public function frontControllerPath($sitePath, $siteName, $uri)
{
return $sitePath.'/public/index.php';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment