phptools-docs
phptools-docs copied to clipboard
Navigation to file by functions
Hello there!
I would like to suggest navigation to file by Laravel functions like:
asset()
secure_asset()
public_path()
storage_path()
When parameter path is informed.
Also, navigation to files informed in @vite directive.
Maybe it's something obvious, but, algo highlight when the file does not exist.
The same when using __DIR__, something like this:
Good point;
How to safely determine the location of directories for
- asset() - /public/...
- public_path() - /public/...
- storage_path() - /storage/...
I can see this is highly configurable, What is the "reasonable" configuration we should check for?
Good point;
How to safely determine the location of directories for
- asset() - /public/...
- public_path() - /public/...
- storage_path() - /storage/...
I can see this is highly configurable, What is the "reasonable" configuration we should check for?
@jakubmisek these native Laravel helper functions can be configured, yes.
This configuration can be done in bootstrap/app.php.
For Laravel below version 11 (this is the working way for me, in Service Provider doesn't work properly):
For Laravel 11 and above:
But this configuration can be done for other things, like:
- useConfigPath()
- useBootstrapPath()
- useAppPath()
- useDatabasePath()
- useEnvironmentPath()
Basically just look at the bootstrap/app.php file.
Obs: The asset() function just points to the url() method appending the path. I believe it can't be configured.
Thank you @trollfalgar !
For now, we'll use the default values; if they don't exist, we won't suggest anything.
In the next update, we'll try to be smarter about the paths.