Skip to content

Instantly share code, notes, and snippets.

@mohsin
Created August 25, 2020 07:06
Show Gist options
  • Save mohsin/65d342571a72861fcada8659145459eb to your computer and use it in GitHub Desktop.
Save mohsin/65d342571a72861fcada8659145459eb to your computer and use it in GitHub Desktop.
Valet driver equivalent of the extensionless-php nginx directive
<?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