Functions w/o Class
Within your
app/Http
directory, createhelpers.php
file and add your functions:function ($x, $y){ //return blah blah; }
- Within
composer.json
in theautoload
block, add"files": ["app/Http/helpers.php"]
- Run
composer dump-autoload
in the terminal
With Class
in app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
require_once __DIR__ . '/../Http/helpers.php';
}
}