An autoloader is a feature to allow classes and functions from different files to be included automatically when they are first called. This saves the need to explicitly include all of the files, or create a monstrous global functions/classes file.
Questions tagged [autoloader]
388 questions
-1
votes
2 answers
Composer PSR-4 autoloading completely ignored
I have composer.json file:
{
"name": "marko/art-empire",
"description": "Social network",
"type": "project",
"authors": [
{
"name": "Marko Ilic",
"email": "markowebdeveloper@gmail.com"
}
…

Marko
- 1
- 2
-1
votes
1 answer
Codeigniter Model autoloading not working for MY_Loader class
I've added "header_model" into codeigniter's autoload.php file. now its:
$autoload['model'] = array("header_model");
And i also can successfully use $this->header_model in other controllers.
But can't use it in MY_Loader class, which is extension…

Nick
- 455
- 9
- 28
-1
votes
1 answer
Autoloader for distributed PHP plugins that includes composer packages
I am working with a CMS that requires the user to upload extensions.
The users do not have access to composer. So I will need to include the dependencies in the distribution itself.
Would how I implement it work for autoloading all dependencies? Is…

JC Lee
- 2,337
- 2
- 18
- 25
-1
votes
1 answer
PHP Composer PSR-4 autoloader not working
I'm trying to build a composer package for one of my old libraries. I'm also bit new to GIT. Doing this I'm also learning git workflow. I'm following these articles for building composer package.
1 -…

Suresh
- 5,687
- 12
- 51
- 80
-1
votes
1 answer
Fatal error: exactly/the/good/way/class not found
I got the Fatal Error:
Fatal error: Class 'app\Autoloader' not found in C:\wamp64\www\WE\index.php
In other words:
Fatal error: exactly/the/good/way/class not found
begin of my script index.php

Pierre-alexis Krstic
- 11
- 5
-1
votes
2 answers
PHP autoloader - $classname includes the entire folder path and not just the class name itself?
I am following WordPress's naming convention where a class My_Class should reside in the file named class-my-class.php. I used this autoloader for WordPress, written by Rarst. If I print out the $class_name variable, I see that the prefix class is…

Rutwick Gangurde
- 4,772
- 11
- 53
- 87
-1
votes
1 answer
Composer Autoloading PHP
I need help with composer autoloader. Well in my opinion I have set up everything correctly, but still I am having an error "class has been not found".
So maybe someone here will be able to help me.
Look at the screenshoots below to understand the…

Dariss
- 1,258
- 1
- 12
- 27
-1
votes
1 answer
Php syntax error syntax error, unexpected '[', expecting ')' str_replace, PSR-0 Autoloader
I'm dabbling w/ a 'lightweight' PSR-0 AutoLoader for a WordPress Plugin,
it runs fine on my local dev server, but when i push it up to one of WPEngine's staging servers, i get this:
Parse error: syntax error, unexpected '[', expecting ')' in…

joelrnorris
- 185
- 4
- 15
-1
votes
1 answer
PHP can not include file when Autoload is ON
I have my own MVC and autoloader that loads classes. Everything works except that my base View.php is in Core folder and its render function does the following:
public function render($file) {
include('Project/Views/index/header.php');
…

Giorgi
- 609
- 2
- 15
- 29
-2
votes
1 answer
PHP "Helper Class" - Class not found
I am having an issue that coming from PHP 5.3.2 to 5.3.3 the code no longer can find the "I2A2" class.
Here is some info:
Error:
ErrorException [ Error ]: Class 'I2A2' not found
Fatal error: Class 'I2A2' not found in…

LukePOLO
- 1,110
- 3
- 13
- 28
-2
votes
1 answer
How does composer know which classes are used?
I was wondering how Composer knows which classes are used in the scripts that will be executed. Does PHP provide a hooking mechanism with a callback? I'm guessing it's not inspecting the code since the following code works (provided the PHP Redis…

kaan_a
- 3,503
- 1
- 28
- 52
-2
votes
1 answer
Custom Class not found weird error in Laravel 4 using PSR-4 Autoloading
In my custom class.
api_function('admin_login', $data);
}
public function…

aldrin27
- 3,407
- 3
- 29
- 43
-3
votes
1 answer
Class not found using namespace compilant PSR-4 on PHP
I'm very confusing about namespace on php (>5.4.*) and composer
Scenario
|vendor
|autoload.php
|abkrim
|cputils
|src
|CpPanelBackTest.php
Code CpPanelBackTest.php
namespace Abkrim\Cputils;
class…

abkrim
- 3,512
- 7
- 43
- 69