{"id":19357740,"url":"https://github.com/joomla-framework/controller","last_synced_at":"2025-04-23T11:30:31.688Z","repository":{"id":7094510,"uuid":"8385794","full_name":"joomla-framework/controller","owner":"joomla-framework","description":"Joomla Framework Controller Package","archived":false,"fork":false,"pushed_at":"2024-10-08T21:11:37.000Z","size":5457,"stargazers_count":2,"open_issues_count":2,"forks_count":6,"subscribers_count":14,"default_branch":"3.x-dev","last_synced_at":"2025-04-02T14:21:47.463Z","etag":null,"topics":["controller","joomla","joomla-framework","mvc","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joomla-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"joomla","custom":"https://community.joomla.org/sponsorship-campaigns.html"}},"created_at":"2013-02-24T03:22:28.000Z","updated_at":"2024-08-15T17:58:43.000Z","dependencies_parsed_at":"2024-08-17T10:47:31.191Z","dependency_job_id":"0477a68d-e072-41df-8d69-899b88e534f7","html_url":"https://github.com/joomla-framework/controller","commit_stats":{"total_commits":93,"total_committers":11,"mean_commits":8.454545454545455,"dds":0.5053763440860215,"last_synced_commit":"a903defd304a5567671f2af53bd16a5b8ac55ed8"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Fcontroller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Fcontroller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Fcontroller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joomla-framework%2Fcontroller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joomla-framework","download_url":"https://codeload.github.com/joomla-framework/controller/tar.gz/refs/heads/3.x-dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250424926,"owners_count":21428469,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["controller","joomla","joomla-framework","mvc","php"],"created_at":"2024-11-10T07:09:01.836Z","updated_at":"2025-04-23T11:30:31.400Z","avatar_url":"https://github.com/joomla-framework.png","language":"PHP","funding_links":["https://github.com/sponsors/joomla","https://community.joomla.org/sponsorship-campaigns.html"],"categories":[],"sub_categories":[],"readme":"# The Controller Package [![Build Status](https://ci.joomla.org/api/badges/joomla-framework/controller/status.svg?ref=refs/heads/3.x-dev)](https://ci.joomla.org/joomla-framework/controller)\n\n[![Latest Stable Version](https://poser.pugx.org/joomla/controller/v/stable)](https://packagist.org/packages/joomla/controller)\n[![Total Downloads](https://poser.pugx.org/joomla/controller/downloads)](https://packagist.org/packages/joomla/controller)\n[![Latest Unstable Version](https://poser.pugx.org/joomla/controller/v/unstable)](https://packagist.org/packages/joomla/controller)\n[![License](https://poser.pugx.org/joomla/controller/license)](https://packagist.org/packages/joomla/controller)\n\n## Interfaces\n\n### `Controller\\ControllerInterface`\n\n`Controller\\ControllerInterface` is an interface that requires a class to be implemented with the following methods:\n\n- `execute`\n- `getApplication`\n- `getInput`\n- `setApplication`\n- `setInput`\n\n## Classes\n\n### `Controller\\AbstractController`\n\n#### Construction\n\nThe 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.\n\n#### Usage\n\nThe `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.\n\n```php\nnamespace Examples;\n\nuse Joomla\\Application;\nuse Joomla\\Input;\n\n/**\n * My custom controller.\n *\n * @since  1.0\n */\nclass MyController extends Controller\\Base\n{\n\t/**\n\t * Executes the controller.\n\t *\n\t * @return  void\n\t *\n\t * @since   1.0\n\t * @throws  \\RuntimeException\n\t */\n\tpublic function execute()\n\t{\n\t\techo time();\n\t}\n}\n\n// We'll assume we've already defined an application in this namespace.\n$app = new ExampleApplication;\n$input = new Input\\Input;\n\n// Instantiate the controller.\n$controller = new MyController($input, $app);\n\n// Print the time.\n$controller-\u003eexecute();\n```\n\n#### Serialization\n\nThe `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.\n\n\n## Installation via Composer\n\nAdd `\"joomla/controller\": \"~3.0\"` to the require block in your composer.json and then run `composer install`.\n\n```json\n{\n\t\"require\": {\n\t\t\"joomla/controller\": \"~3.0\"\n\t}\n}\n```\n\nAlternatively, you can simply run the following from the command line:\n\n```sh\ncomposer require joomla/controller \"~3.0\"\n```\n\nIf you want to include the test sources, use\n\n```sh\ncomposer require --prefer-source joomla/controller \"~3.0\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoomla-framework%2Fcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoomla-framework%2Fcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoomla-framework%2Fcontroller/lists"}