You have common functions you want available for every request.
But you don’t want to dirty up
app\start\global.php with a bunch of functions.
First create the file
// My common functions
return (mt_rand(1,2) == 1) ? 'something' : 'other';
Then either load it at the bottom of app\start\global.php as follows.
Or change your composer.json file and dump the autoloader.
$ composer dump-auto
You can have multiple types of helpers.
The standard Laravel setup has app/filters.php and app/routes.php but you can create whatever your application needs.
Here are some suggestions.
app/helpers.php – For general purpose functions.
app/composers.php – To initialize all your View composers in one place.
app/listeners.php – To set up all your event listeners in one place.
app/observers.php – Or, if you like observers better than listeners use this filename for event listeners.
It’s really up to you and the demands of your application.