So, for example, I have 3 classes: Division, Employee, Task. Every task has an employee assigned to it and every employee belongs to a division. Currently I need 4 views:

  • a list of tasks assigned to a selected employee,
  • a list of employees working on a selected task,
  • a list of tasks an employee from a selected divison has worked on,
  • a main list that will show a list of task with an amount of employees it was assigned to.

Outside of joomla if I need to get, for example, a list of tasks assigned to an employee, I just do something like:

$employee = new employee($id_of_employee);
$tasks = $employee->get_tasks();

So what is the best way to integrate it with joomla? Can I include my classes in a component or I'll have to redevelop it?

2 Answers 2


Yes, You can simply include and instantiate your classes and interact with them the standalone PHP way you are used to - yes that is not a problem and Joomla doesn't restrict your ability to that - this approach gives you less to rewrite of your original code.

However if you were up for a challenge, you could refactor your code classes - which are actually models, and create a Model that extends JModelItem from them that Joomla could consume in its views.

Full Official Documentation on creating a Joomla 3.x Extension is available for this.

  • Ok... So, if my class extends another one, can a model extend another model? And can I call another model from a model? Commented Dec 5, 2015 at 18:10
  • 2
    yes yes and yes. Basic PHP 101 :)
    – user239
    Commented Dec 5, 2015 at 20:25

Try following code -



$instance = new Yourclass();

You can also use a static class with inherited methods like:


You can also inherit or extend Joomla classes (check the documentation) and please use Joomla's native functions for mailing or database management.

If you use php files with Joomla, please put the following line at the top of every file to prevent external access to your scripts:

defined('_JEXEC') or die('Restricted access');

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.