Questions tagged [autoloader]

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.

388 questions
0
votes
1 answer

External class not loading in Laravel

Just getting started with Laravel and struggling a bit with the learning curve and lack of detailed documentation. I am trying to use class.upload.php by verot.net and cannot seem to get the class to load. I uploaded the class directory to…
NightMICU
  • 9,000
  • 30
  • 89
  • 121
0
votes
1 answer

Autoloading both Classes & Models

I know it's common practice to autoload your controllers when using an MVC framework. I have made my own mini-framework where controllers are autoloaded fine. Are there any security/bad issues with having the same autoload function load the models…
imperium2335
  • 23,402
  • 38
  • 111
  • 190
0
votes
3 answers

Is it wrong to use the return statement this way?

I've got this autoloader method which is used to include class files as needed. public static function autoloader($className) { $fileExists = false; foreach(array(LIBS_PATH, CONTROLLERS_PATH, MODELS_PATH) as $path) { // Check if…
David
  • 210
  • 3
  • 11
0
votes
1 answer

Symfony autoloader component

I'm getting: Fatal error: Class 'Twig_Loader_Filesystem'
John
  • 2,900
  • 8
  • 36
  • 65
0
votes
1 answer

Autiloader and PHP session crushing in two applications on the same server

I had one problem with Autoloader function in PHP when I was switching between two applications which has same framework and share the same session (because they are on the same server, etc. localhost). Autoloader actually kept searching for…
Mladen Janjetovic
  • 13,844
  • 8
  • 72
  • 82
0
votes
1 answer

In PHP I have a custom autoloader, how to extend it for namespaces?

I have a custom autoloader in php. The search pathes are set in an array. The loading itself: $classname the name of the nonloaded class $path the directories $autoloadClassPaths [classname] => absolute filename THIS IS a spl_autoload_register()…
John Smith
  • 283
  • 5
  • 12
0
votes
1 answer

How to upgrade Zend_Loader from 1.7 to 1.8?

I have been using this, and it works fine in 1.7, but not in 1.8. require_once('Zend/Loader.php'); Zend_Loader::registerAutoload(); It says it's deprecated, and that I should use Zend_Loader_Autoloader instead, but I can't seem to get it to…
lo_fye
  • 6,790
  • 4
  • 33
  • 49
0
votes
1 answer

Autoloader Functions error

I have always used includes if I have wanted to bring in a class I have never used the autoloader function. When I use the function for some reason I continue to get the error. " Warning: include_once(classes/user.class.php): failed to open…
Michael Crawley
  • 125
  • 2
  • 2
  • 5
0
votes
1 answer

Autoloader appears to be omniscient | Nested includes not needed

I use this simple autoloader code: function __autoload( $class_name ) { include 'class.' . $class_name . '.php'; } and I make this call new SDB(); SDB actually inherits from SDBOne which I never include...yet the auto-loader loads it. This means it…
user656925
0
votes
2 answers

autoloader for loading classes won't work as expected

recently i started working with OOP and i created a classLoader to load the classes i use.. so i made this class and worked with it ( local ) and all went fine. But when i uploaded everything to my webhost it stopped working. i get the following…
Reshad
  • 2,570
  • 8
  • 45
  • 86
0
votes
3 answers

Class not found PHP OOP

I can't get this to work. getPar("price"); ?> And this is…
djpredator17
  • 103
  • 7
0
votes
1 answer

ZF Namespace Autoloader en Bootstrapping

I have a standard ZF structure library -wil -Auth -Adapter.php In this folder /libary/Wil/Auth/Adapter I have this class based on http://www.zendcasts.com/logging-in-users-using-doctrine-and-zend_auth/2010/01/ class Wil_Auth_Adapter…
Wil
  • 1,778
  • 1
  • 16
  • 15
0
votes
1 answer

Autoloading problems using spl_autoload_register

First off, i like to tell you my directory structure - /var/www |- /social_network/ |- index.php |- /application/ |-/controllers/ |-user.php |- /models/ |- framework.php |-/tmp/ In my…
Haider Ali
  • 918
  • 2
  • 9
  • 26
-1
votes
1 answer

How to troubleshoot Composer autoload in Codeigniter?

I am new to using Composer in Codeigniter and have read all I can to try and fix my issue, but are coming up short. The autoloader seems to to be autoloading? So here is where I am stuck: I have installed a composer. Required the MPDF package using…
-1
votes
1 answer

My composer autoload file don't contain classes

I'm creating a REST API with PHP using Composer and coffeecode/datalayer library but when I'm trying to load my class I receive Class not found error and when I type dump-autoload on terminal I get Generated autoload files containing 0…
1 2 3
25
26