Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Created January 4, 2017 22:06
Show Gist options
  • Save peterjaap/99e016f4963f1f027c2fe68849896898 to your computer and use it in GitHub Desktop.
Save peterjaap/99e016f4963f1f027c2fe68849896898 to your computer and use it in GitHub Desktop.
Magento 1 Driver for Valet (https://laravel.com/docs/5.3/valet) - we put Magento in a subdir called 'magento' in our Git repo. So place this in ~/.valet/Drivers/Magento1ValetDriver.php and you're good to go.
<?php
class Magento1ValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return boolean
*/
public function serves($sitePath, $siteName, $uri)
{
return file_exists($sitePath . '/magento/app/etc/local.xml') && file_exists($sitePath . '/magento/index.php');
}
/**
* 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 . '/magento' . $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 . '/magento/index.php';
}
}
@IamSwap
Copy link

IamSwap commented Jun 11, 2017

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment