Welcome Guest, Not a member yet? Register   Sign In
Class not found for elFinder(Open-source file manager for web) in Codeigniter 4
#2

1. You can remove the include_once lines in your elfinder_lib class.
2. Elfinder is not using PSR4 to name their classes so you cannot do so either. You should use class map.
app/Config/Autoload.php
PHP Code:
public $classmap = [
    
'elFinderConnector' => APPPATH 'ThirdParty/elfinder/elFinderConnector.class.php',
    
// enumerate other elfinder classes
]; 
3. In your elfinder_lib class, when calling elFinderConnector you should qualify the call.
PHP Code:
<?php
namespace App\Libraries;

class 
Elfinder_lib 
{
  public function 
run($opts) {
        
$connector = new \elFinderConnector(new \elFinder($opts));
        return 
$connector->run();
    }

4. Alternative to #3, you can import them instead
PHP Code:
<?php
namespace App\Libraries;

use 
elFinderConnector;
use 
elFinder;

class 
Elfinder_lib 
{
  public function 
run($opts) {
        
$connector = new elFinderConnector(new elFinder($opts));
        return 
$connector->run();
    }

Reply


Messages In This Thread
RE: Class not found for elFinder(Open-source file manager for web) in Codeigniter 4 - by paulbalandan - 07-28-2021, 10:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB