Support the ongoing development of Laravel.io →
Configuration Blade
Last updated 2 years ago.
0

Have you named your class that ? Just give it a look.

Last updated 2 years ago.
0

Yes, I already do. Those class is working just fine in Laravel 4.

BTW nice Bioman avatar :)

Last updated 2 years ago.
0

Are you properly importing the class ? I assume you have put that class in global namespace.

L5 uses PSR-4 autoloading, try keeping your classes in namespaced.

... tX !

Last updated 2 years ago.
0

Here are my steps :

The content for app/library/myFunctions.php is below :

<?php namespace App\library {
	class myFunctions {
		public function is_ok() {
			return 'myFunction is OK';
		}
	}
}
?>

At resources/views/test.blade.php , I added :

<?php
  $FmyFunctions1 = new myFunctions;
  $is_ok = ($FmyFunctions1->is_ok());
?>

Then at composer.json within "autoload": I added :

    "files": [
        "app/library/myFunctions.php"
    ],

And within app\Http\Controllers\HomeController.php at public index() I add :

return view('test');

But it always give me error messages regarding 'myFunctions' as below :

Whoops, looks like something went wrong. 1/1 FatalErrorException in xxxx line 7: Class 'myFunctions' not found in xxxx line 7 at HandleExceptions->handleShutdown()

Last updated 2 years ago.
0
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sidhi sidhi Joined 22 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.