Created
August 25, 2020 07:06
-
-
Save mohsin/65d342571a72861fcada8659145459eb to your computer and use it in GitHub Desktop.
Valet driver equivalent of the extensionless-php nginx directive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Valet Driver equivalent of http://www.tweaktalk.net/60/nginx-remove-php-file-extension-from-url | |
*/ | |
class LocalValetDriver extends LaravelValetDriver | |
{ | |
/** | |
* Ensure only files which have a .php file on disk get served by this driver. | |
*/ | |
public function serves($sitePath, $siteName, $uri) | |
{ | |
return file_exists($sitePath . $uri . '.php'); | |
} | |
/** | |
* Return that php file to handle the request. | |
*/ | |
public function frontControllerPath($sitePath, $siteName, $uri) | |
{ | |
return $sitePath . $uri . '.php'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment