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

jakegroves's avatar

Class not found on shared hosting version

I have my laravel application on 1and1 shared hosting its all working but i have a custom class called 'MyFunctions' that is located in ~/project/app/library/MyFunctions.php

I am calling this up in the view and works perfectly fine on local hosting (XAMPP) but when i try to load a page using the class i get this error:

FatalErrorException in 7fe5fab2e881a51735f18c543998448bac15c1d7.php line 22: Class 'project\app\library\MyFunctions' not found

I do not know why??? the code that is throwing the error is:

Lesson: {{ \project\app\library\MyFunctions::lesson($student->pivot->lesson_id)->name }}

i have tried using ~\ befoore it etc and it cannot find it?

Any reason why it may be doing it on the shared hosting?

0 likes
5 replies
MarkLL's avatar
MarkLL
Best Answer
Level 7

Hi @jakegroves what Namespace did you use in MyFunctions ? Looking at the location (/app/library/) the namespace should be App\library.

In the blade file you should reference it via the Namespace not the physical location. so it should be something like \App\library\MyFunctions::lessons(...).

jakegroves's avatar

@MarkLL okay yer i see that now the namesapce was App\library but it is wierd because it is not picking up the issue on local hosting .... is there a reason why it is doing that?? because I am not going around changing \App\Library... to \App\library... now and its working fine... thanks for that i feel silly just curious if there is a reason why it works on one and not the other.

MarkLL's avatar

@jakegroves check the case for the "library" folder. You namespace indicate it should be Library and not library... e.g. it case sensitive.

jakegroves's avatar

@MarkLL I understand that now but all my references to that in different views were varying from App\Library\ to App\library\ and they all worked on local hosting, was just curious why it allowed it to work

MarkLL's avatar

@jakegroves I would say it's because you were developing on Windows which is not case sensitive versus a Linux server which is... :)

Please or to participate in this conversation.