laravel get current directory code example

Example 1: laravel get project root

public_path(); // Path of public/
base_path(); // Path of application root
storage_path(); // Path of storage/
app_path(); // Path of app/

Example 2: laravel get public path url

// Path to the project's root folder    
echo base_path();

// Path to the 'app' folder    
echo app_path();        

// Path to the 'public' folder    
echo public_path();

// Path to the 'storage' folder    
echo storage_path();

// Path to the 'storage/app' folder    
echo storage_path('app');

Tags:

Php Example