{"id":17481208,"url":"https://github.com/paratron/kiss-tools","last_synced_at":"2025-04-22T13:21:39.076Z","repository":{"id":141688043,"uuid":"2672937","full_name":"Paratron/KISS-tools","owner":"Paratron","description":"A collection of random php classes and other stuff which might be useful in web app development","archived":false,"fork":false,"pushed_at":"2015-01-06T14:06:03.000Z","size":269,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-19T01:18:44.699Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://wearekiss.com/","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/Paratron.png","metadata":{"files":{"readme":"README-SlimRouter.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-29T23:05:19.000Z","updated_at":"2022-11-26T07:22:29.000Z","dependencies_parsed_at":"2023-03-13T10:29:46.737Z","dependency_job_id":null,"html_url":"https://github.com/Paratron/KISS-tools","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/Paratron%2FKISS-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paratron%2FKISS-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paratron%2FKISS-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Paratron%2FKISS-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Paratron","download_url":"https://codeload.github.com/Paratron/KISS-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250246746,"owners_count":21398919,"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-18T22:08:55.231Z","updated_at":"2025-04-22T13:21:39.056Z","avatar_url":"https://github.com/Paratron.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"SlimRouter\n==========\nThe SlimRouter is a tool you can use in combination with the slim php framework.\nIt enables you to configure your application routes in a very simple way without writing much php code.\n\nSetting up an app to use SlimRouter\n-----------------------------------\nLets assume you are using Slim, a controller class object with a couple of custom functions with special application logic and have a directory of templates with static pages.\nSet up your app like so:\n\n    //First include the needed parts.\n    include('Slim/Slim.php');\n    include('MyController.php');\n    include('SlimRouter.php');\n\n    //Now create an instance of Slim.\n    $slim = new Slim();\n\n    //Create an instance of your controller class.\n    $controller = new MyController();\n\n    //And finally create an instance of the router.\n    $router = new SlimRouter($slim, 'secure_directory/routes.json', $controller);\n\n    //And tell the router to set everything up for you.\n    $router-\u003eset_routes();\n\n    //Thats it. Run the app!\n    $slimg-\u003erun();\n\nThis code tells the SlimRouter to use the routes.json file to set up all your applications routes.\nLets have a look how such a json file looks like.\n\nThe routes.json config file\n---------------------------\n\n    {\n        \"/url_scheme\":      \"desired action\",\n        \"/another/url\":     \"function_call()\",\n        \"/one/more/url\":    \"my_template.html\"\n    }\n\nThe content of the json file is one json object with many key:value pairs. The key is always the URL-scheme to match.\nYou can make the full use of slims regex url-schemes, for example: \"/this/:is(/:my(/:scheme))\"\n\nYou can specify special HTTP methods for which the url scheme should match.\nFor example: \"POST\u003e/url_scheme\"\nThis the app only responding to the URL, if its called via HTTP-POST.\nMultiple methods work, too: \"GET,POST\u003e/url_scheme\".\nIf you specify no HTTP method, SlimRouter will assume you meant \"GET\".\n\n\nThe value of the key/value pair specifies what to show if the url scheme is matched.\nIn the routes.json file, you can specify two kinds of things. Call a function of the controller, or show a static template.\n\nIf you set up your routes.json like the following:\n\n    {\n        \"/url_scheme\" : \"test()\"\n    }\n\nThen then $controller-\u003etest() will be called. If you specified any parameters in your url scheme, the parameters will be passed to the function.\n\nIf you want to simply load and display a template out of your templates folder, then pass the filename to the template there:\n\n    {\n        \"/url_scheme\": \"my_template.php\"\n    }\n\nDue to security reasons, no parameters of the url will be passed to the template, since you have no control over them.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparatron%2Fkiss-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparatron%2Fkiss-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparatron%2Fkiss-tools/lists"}