2017 © Pedro Peláez
 

joomla-package controller

Joomla Controller Package

image

joomla/controller

Joomla Controller Package

  • Saturday, July 14, 2018
  • by mbabker
  • Repository
  • 11 Watchers
  • 0 Stars
  • 12,201 Installations
  • PHP
  • 4 Dependents
  • 1 Suggesters
  • 3 Forks
  • 0 Open issues
  • 10 Versions
  • 8 % Grown

The README.md

The Controller Package Build Status

Interfaces

Controller\ControllerInterface

Controller\ControllerInterface is an interface that requires a class to be implemented with the following methods:\, (*1)

  • execute
  • getApplication
  • getInput
  • setApplication
  • setInput

Classes

Controller\AbstractController

Construction

The constructor for Controller\AbstractController takes an optional Joomla\Input\Input object and an optional Joomla\Application\AbstractApplication object. One or the other can be omitted but using getApplication or getInput without setting them will throw an exception., (*2)

Usage

The Controller\AbstractController class is abstract so cannot be used directly. The derived class must implement the execute method to satisfy the interface requirements. Note that the execute method no longer takes a "task" argument as each controller class. Multi-task controllers are still possible by overriding the execute method in derived classes. Each controller class should do just one sort of 'thing', such as saving, deleting, checking in, checking out and so on. However, controllers, or even models and views, have the liberty of invoking other controllers to allow for HMVC architectures., (*3)

namespace Examples;

use Joomla\Application;
use Joomla\Input;

/**
 * My custom controller.
 *
 * @since  1.0
 */
class MyController extends Controller\Base
{
    /**
     * Executes the controller.
     *
     * @return  void
     *
     * @since   1.0
     * @throws  \RuntimeException
     */
    public function execute()
    {
        echo time();
    }
}

// We'll assume we've already defined an application in this namespace.
$app = new ExampleApplication;
$input = new Input\Input;

// Instantiate the controller.
$controller = new MyController($input, $app);

// Print the time.
$controller->execute();

Serialization

The Controller\AbstractController class implements Serializable. When serializing, only the input property is serialized. When unserializing, the input variable is unserialized and the internal application property is loaded at runtime., (*4)

Installation via Composer

Add "joomla/controller": "~1.0" to the require block in your composer.json and then run composer install., (*5)

{
    "require": {
        "joomla/controller": "~1.0"
    }
}

Alternatively, you can simply run the following from the command line:, (*6)

composer require joomla/controller "~1.0"

If you want to include the test sources, use, (*7)

composer require --prefer-source joomla/controller "~1.0"

The Versions

14/07 2018

dev-2.0-dev

dev-2.0-dev https://github.com/joomla-framework/controller

Joomla Controller Package

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

  • php ~7.0

 

The Development Requires

framework controller joomla

30/06 2018

dev-master

9999999-dev https://github.com/joomla-framework/controller

Joomla Controller Package

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

 

The Development Requires

framework controller joomla

09/02 2014

1.1.1

1.1.1.0 https://github.com/joomla-framework/controller

Joomla Controller Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework controller joomla

23/10 2013

1.0

1.0.0.0 https://github.com/joomla/joomla-framework-controller

Joomla Controller Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework controller joomla

23/10 2013

1.1.0

1.1.0.0 https://github.com/joomla/joomla-framework-controller

Joomla Controller Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework controller joomla

22/10 2013

1.0-beta3

1.0.0.0-beta3 https://github.com/joomla/joomla-framework-controller

Joomla Controller Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework controller joomla

16/08 2013

1.0-beta2

1.0.0.0-beta2 https://github.com/joomla/joomla-framework-controller

Joomla Controller Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework controller joomla

16/08 2013

1.0-beta

1.0.0.0-beta https://github.com/joomla/joomla-framework-controller

Joomla Controller Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework controller joomla

04/06 2013

1.0-alpha

1.0.0.0-alpha https://github.com/joomla/joomla-framework-controller

Joomla Controller Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework controller joomla