I was reading some tutorials on creating custom classes for Laravel. I followed instructions and did exactly what tutorials say:
Created new folder laravel/app/libraries/graphics/
Edited laravel/app/start/global.php where I added:
app_path().'/libraries/graphics',
Created new file in laravel/app/libraries/graphics/ named Image.php with this code:
<?php namespace graphics/Image; class Image { public static function hello() { return 'Hello'; } }
Used
composer dump-autload
commandRoute::get('/' , function() { return Graphics\Image::hello(); } );
is returning error:
Use of undefined constant graphics - assumed 'graphics'
I also added "app/libraries/graphics/Image.php"
line into composer.json autload section, which should not be neccessary. Why I am getting this error? Every tutorial shows the same procedure for this, but why it doesn't work?