{"id":17226867,"url":"https://github.com/dantleech/mvc","last_synced_at":"2025-03-25T17:48:31.693Z","repository":{"id":1762395,"uuid":"2675700","full_name":"dantleech/MVC","owner":"dantleech","description":"Really lightweight MVC framework","archived":false,"fork":false,"pushed_at":"2011-10-30T19:37:02.000Z","size":96,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T15:44:33.906Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dantleech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-10-30T15:31:15.000Z","updated_at":"2024-11-04T20:37:05.000Z","dependencies_parsed_at":"2022-09-14T04:30:29.092Z","dependency_job_id":null,"html_url":"https://github.com/dantleech/MVC","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2FMVC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2FMVC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2FMVC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dantleech%2FMVC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dantleech","download_url":"https://codeload.github.com/dantleech/MVC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245515177,"owners_count":20628118,"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":[],"created_at":"2024-10-15T04:17:26.193Z","updated_at":"2025-03-25T17:48:31.671Z","avatar_url":"https://github.com/dantleech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Lightweight MVC Framework\n=========================\n\nThis is a very lightweight MVC framework featuring:\n\n- Dependency Injection\n- URL Router\n- Request Dispatcher\n\nThe components are inspired by Symfony2 (https://github.com/symfony).\n\nNo view or model layers are included. This is just a framework to facilitate the usage\nof third party components.\n\nYou will need to setup an autoloader. I used the Symfony one - https://github.com/symfony/ClassLoader.\n\nThis is a personal project and has NO TESTS.\n\nExample usage\n-------------\n\nAn example `index.php` with including service configuration::\n\n    // web/index.php\n    \u003c?php\n    require_once(__DIR__.'/../bootstrap.php');\n\n    use DTL\\MVC\\Controller\\Request;\n    use DTL\\MVC\\Router\\Route;\n    use DTL\\MVC\\Controller\\Dispatcher;\n    use DTL\\MVC\\Service\\Service;\n    use DTL\\MVC\\Service\\ServiceContainer;\n\n    $sc = new ServiceContainer;\n\n    // set router service\n    $sc-\u003eset('router', new Service('DTL\\MVC\\Router\\Router', array(\n        array(\n            // add routes\n            new Route('\u0026/foobar/(.*)/(.*)\u0026', array('pronoun', 'subject'), 'DTL\\FixturatorWeb\\Controller\\HomeController::index'),\n        )\n    )));\n\n    // set monolog for logging (https://github.com/Seldaek/monolog)\n    $sc-\u003eset('logger', Service::create('Monolog\\Logger', array('MVC'))\n        -\u003eaddMethodCall('pushHandler', array(new Service('Monolog\\Handler\\StreamHandler', array(\n            __DIR__.'/../log/web.log',\n        ))))\n    )\n    ;\n\n    // set the TWIG template engine for use in the controllers (https://github.com/fabpot/twig)\n    $sc-\u003eset('twig', new Service('\\Twig_Environment', array(\n        new Service('\\Twig_Loader_Filesystem', array(\n            __DIR__.'/../lib/DTL/FixturatorWeb/views',\n        ))\n    )));\n\n\n    $dispatcher = new Dispatcher($sc);\n    $request = Request::createFromGlobals();\n    $dispatcher-\u003edispatch($request);\n\nAnd an example controller::\n\n    \u003c?php\n\n    namespace DTL\\FixturatorWeb\\Controller;\n    use DTL\\MVC\\Controller\\Request;\n    use DTL\\MVC\\Controller\\Response;\n    use DTL\\MVC\\Service\\ServiceContainer;\n\n    class HomeController\n    {\n        public function index(ServiceContainer $sc, Request $request)\n        {\n            return Response::create()\n                -\u003esetBody($sc-\u003eget('twig')-\u003erender('Home/index.html.twig', array('hello' =\u003e 'world')))\n                -\u003esetStatusCode(200)\n                -\u003esetHeader('Content-Type', 'text/html');\n        }\n    }\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantleech%2Fmvc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdantleech%2Fmvc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdantleech%2Fmvc/lists"}