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
3
votes
1 answer
ZF2 2 modules with same name from different sources in vendor
I am working on a complex application that is divided in some sub-applications with their own logic. Those sub-applications are included in composer.json file of the main application and the module paths of sub-application are included in the main…

Radu Pavelco
- 63
- 5
3
votes
1 answer
Class Not Found using PSR-4
I have a PSR-4 specification in my composer.json file as below
"autoload" : {
"psr-4" : {
"MyMVC\\" : "app/"
}
},
Above is my directory structure. In my Core/Config.php file i have class Config that is under namespace MyMVC\Core.…

Raheel
- 8,716
- 9
- 60
- 102
3
votes
2 answers
Zend 1 3d party NameSpaces autoload don't working
I'm trying to implement Amazon WebServices PHP SDK into my Zend 1 project, but it seems to fail loading the classes.
I have got the library into library/Eplan/AmazonCloudSearch and after investigation it seems that in order to be able to load the…

Cornezuelo del Centeno
- 501
- 8
- 24
3
votes
6 answers
Codeigniter not working in IIS
Ok, I got an codeigniter app. it works fine in localhost, works fine in a php hosting that I got. But my client wants it running in IIS. I've passed the web.config pitfall but now I get the following error:
An uncaught Exception was…

Paulo Jonko Birriel
- 39
- 1
- 1
- 2
3
votes
2 answers
Travis-CI: Class not found even when using autoloader
Im kind of new with Travis, and I am expreimenting with it right now. I uploaded have my PHP Project on Github and when I let it test via Travis it fails and gives me this error.
PHP Fatal error: Class 'controllers\Welcome' not found in…

Florian Schöffl
- 499
- 3
- 12
3
votes
8 answers
Auto include/require all files under all directories
I would like to automatically include/require all .php files under all directories. For example:
(Directory structure)
-[ classes
--[ loader (directory)
---[ plugin.class.php
--[ main.class.php
--[ database.class.php
I need a…

Adam W
- 317
- 1
- 3
- 15
3
votes
1 answer
How to add a class to Composer for autoloading?
I have a class called class.feed.php, how do I include it to Composer such that when 'vendor/autoload.php' is included or required in my for example index.php, the class will also be included?
Note, am still a PHP newbie.

W3Guy
- 657
- 1
- 7
- 16
3
votes
3 answers
Composer autoload - Class not found exception
I am pulling my hairs out on this one, and that does not happen frequently.
I am trying to use composers autoloader, with a directory of mine. The autoloader works perfectly with another directory.
I am using the following filestructure
-Root
|…

Jonas m
- 2,646
- 3
- 22
- 43
3
votes
1 answer
Getting my head around classes and scope of vars
I'm rewriting a lot of my old mucky spaghetti code and am currently trying to get to grips with classes, functions and loosely rebuilding my site around MVC model.
However, I cannot get my header template include, to reference user account details…

James
- 656
- 2
- 10
- 24
3
votes
1 answer
Horde Autoloader - How to use?
I am new to autoloading in PHP and have a requirement for Horde_Text_Diff in my latest project. I am using Horde_Autoloader to autoload the required files, however, I am not using it correctly. As far as I can Google, there is not a single example…

James Huckabone
- 615
- 1
- 12
- 32
3
votes
1 answer
Symfony2 autoloader found file but did not find class
I am trying to install symfony2 without vendors and I keep getting the following error when running app_dev.php:
RuntimeException: The autoloader expected class "Symfony\Component\EventDispatcher\Event" to be defined in file…

Dr.Knowitall
- 10,080
- 23
- 82
- 133
3
votes
1 answer
What is best way to add additional object classes to my symfony2 controller files?
I'm relatively new to Symfony2, so I'm learning by doing. My controller classes are getting pretty big. I'd like to break it up with functions() or objects->method(). Unfortunately I can't figure out where to put the code. (actually its really…

zipzit
- 3,778
- 4
- 35
- 63
3
votes
1 answer
Re-writing entire website in OOP, am I going about this all wrong?
Up until now all of my websites have been written in very linear code (thanks QBASIC!) which has often caused me grief with repeating, messy and unweilding code. Every dynamic page has always had its own seperate .php file, and I never used…

James
- 656
- 2
- 10
- 24
3
votes
1 answer
jQuery html() getting Javascript (.js) with ?_=1365695139815
When I get an url that contains as the follow example: