I guess you could have a route something like :
Route::get('/php/{script}', ['middleware' => 'auth', function ($script) {
require_once(storage_path("/legacy_php_scripts/{$script}"));
}]);
Nasty though... :-/
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
One of the features that I want to provide in my laravel application is the ability to allow the user to execute pre-built PHP scripts only if they are an authenticated user. I can place these legacy PHP scripts anywhere in the laravel application (e.g. public or storage folder), but I cannot rewrite them in Laravel.
e.g. if the user access http://localhost/php/test.php, then my laravel application should show the test.php output only if he is an authenticated user.
Can this be done? Any help is highly appreciated. Thanks in advance!
I guess you could have a route something like :
Route::get('/php/{script}', ['middleware' => 'auth', function ($script) {
require_once(storage_path("/legacy_php_scripts/{$script}"));
}]);
Nasty though... :-/
Please or to participate in this conversation.