{"id":21540480,"url":"https://github.com/othercodes/fcontroller","last_synced_at":"2025-10-11T05:37:20.511Z","repository":{"id":57033665,"uuid":"56925601","full_name":"othercodes/fcontroller","owner":"othercodes","description":"Front controller and registry that allow us to use several modules with only one entry point or interface.","archived":false,"fork":false,"pushed_at":"2017-10-07T14:56:50.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-11T05:37:20.031Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/othercodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-23T15:14:21.000Z","updated_at":"2017-10-04T14:47:57.000Z","dependencies_parsed_at":"2022-08-23T20:50:34.243Z","dependency_job_id":null,"html_url":"https://github.com/othercodes/fcontroller","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/othercodes/fcontroller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ffcontroller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ffcontroller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ffcontroller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ffcontroller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/othercodes","download_url":"https://codeload.github.com/othercodes/fcontroller/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othercodes%2Ffcontroller/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006349,"owners_count":26084085,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-24T04:19:06.101Z","updated_at":"2025-10-11T05:37:20.475Z","avatar_url":"https://github.com/othercodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FController\n\n[![Build Status](https://travis-ci.org/othercodes/fcontroller.svg?branch=master)](https://travis-ci.org/othercodes/fcontroller) [![Latest Stable Version](https://poser.pugx.org/othercode/fcontroller/v/stable)](https://packagist.org/packages/othercode/fcontroller) [![License](https://poser.pugx.org/othercode/fcontroller/license)](https://packagist.org/packages/othercode/fcontroller)\n\nFController is a container for controllers/modules. This package allow us to register several controllers/modules \nthat can be called in a simply way from a common entry point. In the same way we can register multiple libraries \nor services. These services or libraries will be available in all modules. \n\n## Installation\n\n### With Composer\n\nFirst we have to add the dependencies to the ***composer.json*** file:\n\n```javascrip\n\"require\": {\n    \"othercode/fcontroller\": \"*\",\n}\n```\nThen we have to run the following command:\n\n```bash\ncomposer update\n```\n\n### Stand Alone\n\nWe need to download the package, then extract the content and include in your code the `fcontroller/autoload.php` file.\n\n```php\nrequire_once 'fcontroller/autoload.php';\n```\n\n## Basic Usage\n\nFirst of all we must have the modules we want to the FController handle. For example we have this two dummy modules (classes):\n\n```php\nnamespace OtherCode\\Examples;\n\nclass DummyOne extends \\OtherCode\\FController\\Modules\\BaseModule\n{\n    public function sayHello($name)\n    {\n        $this-\u003estorage-\u003ename = $name;\n        \n        return \"Hello, \" . $name . \"!\";\n    }\n}\n```\n\nThe DummyOne Module has one method `sayHello($name)` that accepts one string as parameter. This method return us a string.\n\n```php\nnamespace OtherCode\\Examples;\n\nclass DummyTwo extends \\OtherCode\\FController\\Modules\\BaseModule\n{\n    public function sayGoodBye()\n    {\n        return \"GoodBye, \" . $this-\u003estorage-\u003ename . \"!\";\n    }\n}\n```\n\nThe DummyTwo Module has once again only one method named `sayGoodBye()`, this method also, return us a string.\n\nLets create a simply application that holds our two modules:\n\n```php\nnamespace OtherCode\\Examples;\n\nrequire_once 'fcontroller/autoload.php';\nrequire_once 'DummyOne.php';\nrequire_once 'DummyTwo.php';\n\n$app = \\OtherCode\\FController\\FController::getInstance();\n$app-\u003esetModule('dummy1', 'OtherCode\\Examples\\DummyOne');\n$app-\u003esetModule('dummy2', 'OtherCode\\Examples\\DummyTwo');\n\ntry {\n\n    $response1 = $app-\u003erun(\"dummy1.sayHello\", array('name' =\u003e 'Rick'));\n    $response2 = $app-\u003erun(\"dummy2.sayGoodBye\");\n\n    var_dump($response1, $response2);\n\n} catch (\\Exception $e) {\n\n    var_dump($e);\n}\n```\n\nThe code above illustrate how we can call two different modules using one entry point. Also we can use \nservices inside our modules. \n\nThis package also has a message queue that can be used to display informative messages from our modules.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fothercodes%2Ffcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fothercodes%2Ffcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fothercodes%2Ffcontroller/lists"}