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

noblemfd's avatar

Class 'AppHelper' not found

In my Laravel project, I am trying to use a custom helper:

namespace App\Http\Helpers;

class AppHelper
{
   public static function toAlphabet($integer){
    $alphabet =   array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
    $alpha_flip = array_flip($alphabet);
    if($integer <= 25){
      return $alphabet[$integer];
    }
    elseif($integer > 25){
      $dividend = ($integer + 1);
      $alpha = '';
      $modulo;
      while ($dividend > 0){
        $modulo = ($dividend - 1) % 26;
        $alpha = $alphabet[$modulo] . $alpha;
        $dividend = floor((($dividend - $modulo) / 26));
      } 
      return $alpha;
    }
 }  
}

In my config/app.php

I have:

'aliases' => [
   'AppHelper' => App\Http\Helpers\AppHelper::class,
];

View

   <td>
          {{AppHelper::toAlphabet($employee->employee_id)}}
    </td>

But when I rendered the view page I got this error:

Class 'AppHelper' not found

How do I resolve this?

Thanks

0 likes
3 replies
Nakov's avatar
Nakov
Best Answer
Level 73

Try clearing the cache in case that's the issue:

php artisan config:clear
noblemfd's avatar

@nakov - The error is gone, but I am not getting the desired result. I want it to display start from A then B and so on. That is

A

B

C ...

But I am getting:

RC

RD

CH

and so on

Nakov's avatar

@noblemfd isn't that a new question now? Did I helped you resolve the main question?

Please or to participate in this conversation.