All Know About Different Root Path Of The Laravel Application With Example

  • 19-06-2022
  • 713
  • Laravel 9
  • Haresh Chauhan

In this post, I will tell you about the laravel application's different app directory paths. This is provided by the laravel framework using this function you can find out the path of the project from any of the files or class.

Using this method you can call the asset and project different asset paths like styles and script or many more project assets.

So in this post i have given all the path function.

Path to the project's root folder

The simple root path of the laravel application.

echo base_path();

You can pass an argument for a deeper path from the root.

echo base_path('public');

Path to the 'app' folders

This will return the app folder path of the laravel application.

echo app_path();        

You can also pass an argument for a deeper path from the app path.

echo app_path('Http');

Path to the 'public' folder

This function will return you the public folder path of the laravel application. There we stored our project assets like images files etc...

echo public_path();

You can pass the argument and go deeper path in the public folder of the laravel application.

echo public_path('images');

Path to the 'storage' folder

This function will return your storage path of the application.

echo storage_path();

Giving argument in this function you can also find the deeper path of the project.

echo storage_path('app');

Class Calling

This app() the method will direct fetch any file from the application.

Here giving an example of the HomeController.php calling controller method. myMethod().


This is my HomeController.php the method here I already define which I calling from here.


namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
    public function myMethod()
        return 'tested';

Asset Calling

This will return URL, return the URL fron the argument passes in the function.

Note: the asset will always return the URL from the given argument.
echo asset('public');



MIX Assets Calling

If you are working with mixed assets like laravel mix, There vue js mixed with the laravel. So we can call the mix function.

<link rel="stylesheet" href="{{ mix('css/app.css') }}">

<script src="{{ mix('css/app.css') }}"></script>

This mixed-asset will work only when you mix up your asset with the laravel vuejs.

We always thanks to you for reading our blogs.


Dharmesh Chauhan

(Swapinfoway Founder)

Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us


Haresh Chauhan


We Are Also Recommending You :