1. To start of with a helper, create a folder called Helpers in the app folder.
2. Create a new file in this folder and call it MyFirstLaravelHelper.php
3. Create a new file in the app\Providers and call it HelperServiceProvider.
4. Fill the HelperServiceProvider with some code to make it autoload all the helpers in the app\Helpers folder.

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

/**
 * @author Chilion Snoek
 *
 * Class HelperServiceProvider
 * @package app\Providers
 */
class HelperServiceProvider extends ServiceProvider
{
    public function register()
    {
        foreach (glob(app_path().'/Helpers/*.php') as $filename) {
            require_once $filename;
        }
    }
}

 

5. Now we need to activate this one, open up config/app.php, add “`App\Providers\HelperServiceProvider::class“` to the list of ServiceProviders.
6. Open up your MyFirstLaravelHelper.php file
7. Put the following code in it:

<?php
	function MyFirstLaravelHelper($greet) {
		return $greet. ' Helper';
	}
?>

 
8. Open up the view where you would want to use this helper.
9. Add the helper as if it was a function. Eg:

@extends("bla.bla")

	@section("content")
		{{MyFirstlaravelHelper("Hello")}}
	@endsection

 
10. Test it in your browser.