Welcome Guest, Not a member yet? Register   Sign In
Extending Autoloader
#1

(This post was last modified: 10-11-2020, 06:14 AM by byazrail.)

Hello,

I made make to CodeIgniter\Autoloader\Autoloader extends.

Normally services extends after errors;
Fatal error: Uncaught Error: Class 'App\CoreExtends\Autoloader' not found
Code:
# Time Memory Function Location
1 0.0000 416496 {main}( ) .../rewrite.php:0
2 0.0001 419648 require_once( '/home/user/public_html/dev/public/index.php' ) .../rewrite.php:26
3 0.0002 420928 require( '/home/user/public_html/dev/core/bootstrap.php' ) .../index.php:115
4 0.0019 441952 Config\Services::autoloader( ) .../bootstrap.php:137

App\Config\Services;

PHP Code:
public static function autoloader(bool $getShared true)
{
    if (
$getShared)
    {
        if (empty(static::
$instances['autoloader']))
        {
            static::
$instances['autoloader'] = new \App\CoreExtends\Autoloader();
        }

        return static::
$instances['autoloader'];
    }

    return new \
App\CoreExtends\Autoloader();


\App\CoreExtends\Autoloader;
PHP Code:
<?php namespace App\CoreExtends;

class 
Autoloader extends \CodeIgniter\Autoloader\Autoloader
{



The purpose for me to do this process.
I need composerFile autoload like Composer.
Sample;

Composer.json
Code:
"autoload": {
    "psr-4": {"MyClass \\": "src /"},
    "files": ["src / functions.php"]
},
Built on CodeIgniter Framework All Projects
Thanks CI Love You Heart
Reply




Theme © iAndrew 2016 - Forum software by © MyBB