PHP Get path in an Laravel application

Laravel framework provides several useful helper methods to get various paths required to access some commonly used directories/folders.

  • app_path() – Laravel app_path helper
  • base_path() – Laravel  helper
  • config_path() – Laravel  helper
  • database_path() – Laravel  helper
  • mix() – Laravel  helper
  • public_path() – Laravel  helper
  • resource_path() – Laravel  helper
  • storage_path() – Laravel  helper

How to get app folder path in laravel ? Laravel app_path php

The app_path method returns the fully qualified ( absolute) path to your application’s app directory.
You may also use the app_path function to generate a fully qualified( absolute) path to a file relative to the application directory:

Laravel Framework Cheat Sheet

Get laravel app base urbottom: 0px !important;border-top-width: 0px !important;

$app->make('url')->to('/');

$app['url']->to('/');

App::make('url')->to('/');

Laravel Scheduler – Cron Tutorial

Task scheduling is an important part of many web applications.

Here are several examples:

  • Check if new emails are received in a specified email accounts inbox, read them and take actions based on the information ( in every minute)
  • Perform batch jobs – etc dispatch order status change emails in an ecommerce system. (once a hour )
  • Clear logs ( once a day )

Laravel makes it super easy and intuitive to use linux CRON scheduler  to perform automated tasks for your web application.

Usually web applications achieve task scheduling by creating several cron jobs in Linux  that execute the required controller methods in the web application. Downside of this approach is that you need to create one cron job for each task.  So if there are 10 tasks , you have to create 10 cron jobs in Linux making it hard to manage.

Laravel adds a layer of programmable logic between the operating system and your web application that you can program your tasks with specified time interval to run them and use a single CRON job .

So once you create general cron job that invokes the laravel scheduler, you are free to programmatically add any number of tasks to run on various time intervals. There are many commonly used time intervals which can be accessed via easy to remember method names such as ->everyMinute(); which obviously runs a given task every minute.

TO be continued. Please provide your feedback below.

How to check the Laravel version using CLI / command prompt and files on Windows or Linux

[vc_row][vc_column][vc_column_text]There are two ways to find the version of your Laravel application . You can either find it by running a command via CLI/ Command Prompt or you can check Laravel version in source files of your Laravel installation.[/vc_column_text][vc_tabs][vc_tab title=”Using Command” tab_id=”1572406098-1-97″][vc_column_text title=”Using command line CLI / Command prompt to find Laravel version” css=”.vc_custom_1572400844663{margin-bottom: 0px !important;}”]Open the terminal / cmd on your system. Now change directory to the web root directory of the Laravel installation and then run the following command to check the Laravel version.[/vc_column_text][mk_padding_divider size=”20″][vc_single_image image=”8915″ img_size=”full” onclick=”link_image”][mk_fancy_title size=”20″ margin_top=”20″ margin_bottom=”0″ font_family=”none”]On Linux[/mk_fancy_title][vc_column_text css=”.vc_custom_1572406835275{margin-bottom: 0px !important;}”]

$php artisan --version

[/vc_column_text][mk_padding_divider size=”20″][mk_fancy_title size=”20″ letter_spacing=”” margin_top=”20″ margin_bottom=”0″ font_family=”none”]On Winows[/mk_fancy_title][vc_column_text css=”.vc_custom_1572406843857{margin-bottom: 0px !important;}”]

c:\xampp\htdocs\laravel_application>php artisan --version

[/vc_column_text][mk_fancy_title size=”20″ margin_top=”20″ margin_bottom=”0″ font_family=”none”]How to check laravel version of a project[/mk_fancy_title][vc_column_text title=”Using command line CLI / Command prompt to find Laravel version” css=”.vc_custom_1576079694183{margin-bottom: 0px !important;}”]You could use either of two methods described above, using terminal/CMD or by inpecting the source files. Please comment if you face any problems following the instructions. We will try to help as fast as we can.[/vc_column_text][/vc_tab][vc_tab title=”Using Source Files” tab_id=”1572406098-2-75″][vc_single_image image=”8922″ img_size=”full” onclick=”link_image”][vc_column_text css=”.vc_custom_1572406696655{margin-bottom: 0px !important;}”]

Open below file in your laravel system using your favourit text editor.

/vendor/laravel/framework/src/Illuminate/Foundation/Application.php

[/vc_column_text][mk_fancy_title size=”20″ margin_top=”20″ margin_bottom=”0″ font_family=”none”]Find laravel version using source files[/mk_fancy_title][/vc_tab][/vc_tabs][/vc_column][/vc_row][vc_row][vc_column][mk_padding_divider size=”20″][/vc_column][/vc_row][vc_row][vc_column][mk_padding_divider][vc_column_text css=”.vc_custom_1572405501990{margin-bottom: 0px !important;}”]

History of Laravel Releases

VersionReleaseBug Fixes UntilSecurity Fixes Until
V1June 2011
V2September 2011
v3February 2012
v4May 2013
5.0Feb 4th, 2015Aug 4th, 2015Feb 4th, 2016
5.1 (LTS)Jun 9th, 2015Jun 9th, 2017Jun 9th, 2018
5.2Dec 21st, 2015Jun 21st, 2016Dec 21st, 2016
5.3Aug 23rd, 2016Feb 23rd, 2017Aug 23rd, 2017
5.4Jan 24th, 2017Jul 24th, 2017Jan 24th, 2018
5.5 (LTS)Aug 30th, 2017Aug 30th, 2019Aug 30th, 2020
5.6Feb 7th, 2018Aug 7th, 2018Feb 7th, 2019
5.7Sep 4, 2018Feb 4th, 2019Sep 4th, 2019
5.8Feb 26th, 2019Aug 26th, 2019Feb 26th, 2020
6.0 (LTS)Sept 3rd, 2019Sept 3rd, 2021Sept 3rd, 2022

[/vc_column_text][vc_column_text css=”.vc_custom_1572405742781{margin-bottom: 0px !important;}”]More in for about versions : https://laravel-news.com/laravel-release-process

[/vc_column_text][/vc_column][/vc_row]