Jason Paddle Jason Paddle - 3 months ago 25
PHP Question

Loading custom class in laravel without dump autoload

I have directory

. Libraries is suppose to hold all custom files and classes. I'm putted new file there but it doesn't work because I need to
.. The problem is that I can't do this. No access to terminal etc..

I have this in

"autoload": {
"classmap": [
"app/libraries", // <<----- this one

Another file which is in libraries from the very beginning is working just fine.

My question is how can I load this new file?


You can try something which I recently tried and it's worked for me. Navigate to vendor/composer/. Since you've said that you have one php file in libraries and it's working this means you will have it in followed files and you can copy/paste the lines and change with your files.

First open file autoload_classmap.php and add at the bottom of the array

'yourfile' => $baseDir . '/app/libraries/yourfile.php',

Second open file autoload_static.php and at the bottom add your file again

public static $classMap = array (
    'yourfile' => __DIR__.  '/../..' . '/app/libraries/yourfile.php',

Save both files and reload. In my case this loaded the files without need of auto-dump.