So, we have a service provider, it connects and uses classes within itself. Is there a way to replace one of its classes with its custom class? Is there a way to force Laravel to load some class with the namespace of the service provider, for example, from its directory in the app before it searches for it in the vendor ?

Read more: The serverfireteam/panel package has a Redactor class (with the namespace Zofe\Rapyd\DataForm\Field ), which connects the file manager elFinder , which, in turn, needs to be replaced with another file manager, since the hoster has banned the use of the proc_open () function and its ilk, which elFinder uses. I need to somehow slip my custom class to it instead of Redactor , without violating the integrity of the package (because editing the vendors is not the same)

    1 answer 1

    Solved the issue this way: Added to composer.json

     "psr-4": { "App\\": "app/", "Zofe\\Rapyd\\DataForm\\Field\\": "app/Field" } 

    where "Zofe \ Rapyd \ DataForm \ Field \" is the namespace of the class in Redactor.php

    In the "app / Field" folder I threw the same file Redactor.php with a class that needs to be replaced. Then I executed "composer dump-auto", Everything, now the class is first of all loaded from "app / Field"