Skip to content

Instantly share code, notes, and snippets.

@dougblackjr
Created September 18, 2018 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dougblackjr/db64bba5e38004dcebfd5c8d3da3baee to your computer and use it in GitHub Desktop.
Save dougblackjr/db64bba5e38004dcebfd5c8d3da3baee to your computer and use it in GitHub Desktop.
Laravel Valet Driver for ExpressionEngine
<?php
/**
* Laravel Valet Driver for ExpressionEngine
* To install:
* 1) Install Valet
* 2) Add this file to the document/project root
*/
class LocalValetDriver extends ValetDriver {
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return bool
*/
public function serves($sitePath, $siteName, $uri) {
// Use this to check whether the test file exists, or return true
// return file_exists($sitePath.'/file-that-identifies-my-framework');
return true;
}
/**
* 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 . '/html/' . $uri)) {
return $staticFilePath;
}
return false;
}
/**
* Get the fully resolved path to the application's front controller. Includes checking for admin panel
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return string
*/
public function frontControllerPath($sitePath, $siteName, $uri) {
if (strpos($uri, '/admin') === 0) {
return $sitePath . '/html/admin.php';
}
return $sitePath . '/html/index.php';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment