All Laravel helper functions written with this logic
if ( ! function_exists('response'))
{
function response($content = '', $status = 200, array $headers = array())
{
// function body
}
}
for first Laravel check is this function exists, if it exists, Laravel will not define this function again(otherwise it will throw fatal error).
So if you will define your function before autoloader include vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
file,
you can define your custom response function.
Unfortunately there is no way to say composer load first your autoload.files
section, then laravel autoload.files
. But you can do small hack ...
open bootstrap/autoload.php
file and include your file before autoloader
// file with your custom helper functions
require __DIR__.'/../app/app/Http/helpers.php';
require __DIR__.'/../vendor/autoload.php';
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…