Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GuntarV's avatar

How do i include/use, for example Carbon class inside helpers file?

MartinS's avatar

Make sure you edit the correct composer file. With your IDE it's easy by mistake to open the frameworks composer file instead of the one belonging to your project.

Nixus's avatar

when I did all this, I found something others:

<?php

namespace App\Http\Controllers;

use function App\Http\array_increase;

class SomeClass 
{
    function doSometime() {
        ...
        $array = array_increase($array, 'image_url');
        ...
    }
}

Nixus's avatar

@mineass You need add a line use function App\Http\array_increase; in the file of your need use it

maymeow's avatar

I just implemented @Bespired solution (1 page behind) and its working like a charm. But need more testing

parag25's avatar
{{ getCountryNameById($val->country_id) }} how may i get country name. help me plz
Previous

Please or to participate in this conversation.