PHP code example of joomla / controller
1. Go to this page and download the library: Download joomla/controller library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
joomla / controller example snippets
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();