My component is using Joomla Categories and I'm using the following code to fetch a category:

$component = Joomla\CMS\Factory::getApplication()->bootComponent('com_khub');
$category = $component->getCategory(['published' => 0])->get($catid);

Joomla is complaining that class Khub\Component\Khub\Site\Service\Category does not exists (at JROOT/libraries/src/Categories/CategoryFactory.php:65).

Of course this works OK with "com_content" and "com_banners" and I've tried to understand where and how those components register Joomla\Component\Content\Site\Service\Category and Joomla\Component\Banners\Site\Service\Category respectively, but with no success (JPATH_COMPONENT/services/provider.php contents are pretty much similar to what I have for my own component),

What am I missing?

Many thanks.

1 Answer 1


Silly me. I was looking at the /services/provider.php file on the administrator part.

This problem was on the site part.

I simply copied "Category.php" from JROOT/components/com_content/src/Service and made the necessary adjustments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.