How to Get Path in Laravel Application Root?
Now, let's see a tutorial of how to get path in laravel. This article goes in detailed on how to get public path in laravel. let’s discuss about how to get base path in laravel. I would like to show you how to get storage folder path in laravel. Alright, let’s dive into the details.
Laravel provide several helper to get path of public directory, app directory, storage directory and base directory. It will help to store files, read file from path and also for other from controller, view files, model etc.
You can see as bellow how to get path of that directory using helper one by one.
How to Get Public Folder Path in Laravel?
public_path(); // /var/www/example-app/public
How to Get Base Path(Project Root) in Laravel?
base_path(); // /var/www/example-app
How to Get Storage Folder Path in Laravel?
storage_path(); // /var/www/example-app/storage
How to Get App Folder Path in Laravel?
app_path(); // /var/www/example-app/app
I hope it can help you...
We are Recommending you
- How to Create Zip File and Download in Laravel 10?
- How to Send Email using Gmail in Laravel 10?
- Laravel Collection map() Add Attribute Example
- How to Automatically Generate Sitemap in Laravel?
- Laravel Send Scheduled Emails Tutorial
- How to Generate QR Code in Laravel?
- Laravel Group By with Max Value Query Example
- Laravel Add Custom Configuration File Example
- Laravel Collection Sum Column Example
- Laravel Signature Pad Example Tutorial
- Laravel Livewire Pagination Example
- How to Get File Extension from Path in Laravel?
- Laravel Eloquent Where Like Query Example Tutorial