8 votes

Why do we need a system autoloader when we are all ready using Composer autoloading?

My understanding of autoloading is fairly rudimentary but since this has 4 votes and no answers I think I will give it a shot. Please more knowledgeable types add corrections or a better answer etc. ...
  • 3,144
4 votes

Why do we need a system autoloader when we are all ready using Composer autoloading?

James did a good differentiator between the composer autoloader and JLoader. I think the other thing that your missing here is that JLoader massively predates composer existing (and even when composer ...
4 votes

Problems auto loading classes with JLoader::registerPrefix

The schema that you're looking for is actually [ComponentName][Directory][Name]. Components generally have at least the following directories: controller, model, view, helpers. For a component called ...
3 votes
Accepted

Proper way for autoloading in Joomla 4

This should still work in 4.0 but will break in 5.0. You are advised to use fully qualified class names. Remove JLoader::register() call and instead add a use statement: use Joomla\Component\Fields\...
  • 8,741
3 votes

Loading custom classes in a component automatically

If the utility classes are only used in your component then include them in a folder within your administrator component. Whether you register the classes with JLoader or just require_once them just ...
  • 3,144
2 votes

Autoloader not working import, discover & registerPrefix

I found the solution: JLoader::import('myextension', JPATH_COMPONENT . '/helpers'); Please note the lower case!
  • 273
2 votes
Accepted

Moving a Joomla site to a new hosting and now getting missing dependency errors

In the end I managed to solve the issue by simply re-creating the page locally (using MAMP), generating an Akeeba backup, and restoring the backup via Kickstart. I really have no idea why this ...
  • 21
1 vote

Moving a Joomla site to a new hosting and now getting missing dependency errors

So there could be an issue with the new hosting if it’s alao a custom solution in that it doesn’t have a tool called composer installed. What I’d recommend: Try reinstalling Joomla (or updating it ...
1 vote
Accepted

Library with namespace and autoloader example

I found the answer finaly i greated an example on github for who is intrested: https://github.com/basd82/joomla_libarary
1 vote
Accepted

Problems auto loading classes with JLoader::registerPrefix

My understanding of the prefix loader is that your filenames will ALWAYS be all lowercase. This is good: JLoader::registerPrefix('Foo', JPATH_LIBRARIES . '/foo'); But then your class names translate ...

Only top scored, non community-wiki answers of a minimum length are eligible