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
4
votes
2 answers

Autoloading Javascript

I have a interesting concept I was working on and looking over, through various stack questions on auto loading JavaScript. I dint want to use a third party tool, aside form jquery, so I thought I would role my own. The concept I have is: var…
user3217071
  • 55
  • 1
  • 4
4
votes
1 answer

ZF2: autoloading libraries without namespaces

Previously I have only been using third party libraries that use namespaces together with Zend Framework 2. Now I need to use a library that does not use namespaces, and I cannot seem to make it work. I installed it via Composer, and it is installed…
ba0708
  • 10,180
  • 13
  • 67
  • 99
4
votes
3 answers

Where should autloader go in MVC?

I'm trying to build a simple MVC framework to better understand certain concepts. The first thing that I thought would be important to address is a front controller that handles all of the requests for my applications. Once I started to think about…
ohiock
  • 646
  • 3
  • 7
  • 22
3
votes
3 answers

How to autoload files in folder under rails app's root

I am trying to have files under myapplication/somefolder. Google and Stackoverflow say I should add this: config.autoload_paths += %W(#{config.root}/somefolder) in my config/application.rb, so I did. But the files don't get loaded. I tried namig…
hakunin
  • 4,041
  • 6
  • 40
  • 57
3
votes
4 answers

PHP like Autoloader in Java

Does the Java Interpreter support an Autoloader-Function or a possibility to extend his "Looking for a class"-function? In PHP there is a function called spl_autoload_register (see http://www.php.net/manual/en/function.spl-autoload-register.php for…
Snowfox
  • 1,112
  • 1
  • 10
  • 12
3
votes
1 answer

Doctrine2 - Single Table Inheritance

I'm trying to apply this tutorial to my project, but I don't get it working. Everytime I try to update my schema i get an error: Fatal error: Cannot redeclare class Rueckgrat\App\Models\ProjectSetting in..... I have 2 files. The first one is…
Abenil
  • 1,048
  • 3
  • 12
  • 26
3
votes
1 answer

Laravel routing cache

When I develop a Laravel application I used to clear cache after making any changes to routes\web.php or routes\api.php. Recently I was working on a project for a fellow and found out that the project does not need clearing cache every time I make a…
3
votes
1 answer

Composer autoloader cannot find class

I have an issue with the class loading of classes. After installing my package it does not find the class, here is its error message: Illuminate\Contracts\Container\BindingResolutionException : Target class…
molbal
  • 974
  • 1
  • 10
  • 23
3
votes
2 answers

How to use simple function in Symfony 4?

I'd like to use a simple function in Symfony 4, something like this : src/Service/Utils.php
Baptiste Costa
  • 1,044
  • 1
  • 12
  • 24
3
votes
2 answers

What is wrong in my composer psr-4 autoload?

I'm creating a web app with Slim and Twig. The libraries I use work perfectly, I can call them easily with no problem. However my own classes are not found by composer.json autoload psr-4 (psr-0 doesn't find them either) Here is my file…
Jean-Marc Zimmer
  • 537
  • 6
  • 20
3
votes
2 answers

Composer PSR-4 autoloading "class not found" debug

Yes another question about the "class not found" error. Either I am missing something, or I misunderstood the PSR-4 logic. My composer library directory sturcture: "Scanner" => "src" => "Test.php" Test.php namespace MyNS; class…
Digital Human
  • 1,599
  • 1
  • 16
  • 26
3
votes
3 answers

Symfony 4 phpunit class WebTestCase not found

I started a new symfony/skeleton project with composer create project. Now I want to add php unit, so I do composer require --dev test Flex downloads and installs phpunit-bridge. However I have a problem with running php unit, as it doesn't seem to…
spiroski
  • 629
  • 2
  • 11
  • 16
3
votes
0 answers

Composer autoloader working in local but not in server

I'm having trouble finding the reason why composer autoloader is not woking in our server. Made sure composer is installed in the server. I am using it in a plugin in Wordpress. I'm trying to activate the plugin but it's returning an error. In my…
Code Diary
  • 417
  • 2
  • 7
  • 17
3
votes
0 answers

JavaScript autoloader

yesterday I saw that there are not many examples of js autoloader, and most of them are written by using jquery,so I wrote the one with plain js and loading it's loading libraries synchronously. Also, here is the link to github repo :…
Aleksandr Sasha
  • 168
  • 1
  • 12
3
votes
2 answers

composer with files not using psr0 and psr4 autoloading (symfony project)

I have a problem with composer auto loader. Currently working on a application which was developed about 10 years back. The folder structure of 2 libraries which are currently used in the project do not comply the psr0 and psr4 auto loading…
shobekhan
  • 171
  • 1
  • 2
  • 15