Steps to reproduce:
laravel new a projecttest.php file in the public folderI've even set the permissions to be 777 to ensure it wasn't a permissions issue to no avail.
I realize this is a little unorthodox but I could not get Laravel's router to use a route name with .php in it and I had to preserve an old URL.
Will try to find some time to reproduce this but this does work for me:
Route::get('foo.php', function () {
return 'foo';
});
Same problem, something in valet nginx configuration. Can't open any .php file but .html files work.
I want to access only this file without passing it through laravel.
If you want to serve raw PHP files from your public directory, I think you are best off creating a custom driver for your project. The standard Laravel nginx config does "support" this but I don't think of this as standard usage of Laravel and don't think we should commit to supporting it in Valet out of the box.
I just came across this post struggling with trying to integrate CKFinder with Laravel - also working with Valet. CKFinder users connector.php file, which won't be recognised - hence it fails to load.
Any indication on how to overcome this issue would be much appreciated.
Metoo. I have using Moxiemanager and moxie users api.php file but fail to load api.php in the public
Any indication on how to overcome this issue would be much appreciated.
anyone found a solution for this by any chance?
for those of you who need create a file inside your project root called LocalValetDriver.php with the following content
<?php
class LocalValetDriver extends LaravelValetDriver
{
private $site_folder = '/public';
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return void
*/
public function serves($sitePath, $siteName, $uri)
{
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.$this->site_folder.$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)
{
$path = $sitePath.$this->site_folder;
return strpos($uri, '.php')
? $path.$uri
: $sitePath.'/public/index.php';
}
}
Most helpful comment
for those of you who need create a file inside your project root called
LocalValetDriver.phpwith the following content