{"id":24110313,"url":"https://github.com/bonndan/tusk","last_synced_at":"2026-05-14T15:31:13.489Z","repository":{"id":142062241,"uuid":"72480981","full_name":"bonndan/tusk","owner":"bonndan","description":"A PHP2Groovy transpiler","archived":false,"fork":false,"pushed_at":"2023-12-15T05:41:20.000Z","size":294,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T11:46:02.298Z","etag":null,"topics":["groovy","php-source","transpiler"],"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/bonndan.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-31T21:51:32.000Z","updated_at":"2017-01-06T19:43:23.000Z","dependencies_parsed_at":"2023-12-15T06:49:27.560Z","dependency_job_id":null,"html_url":"https://github.com/bonndan/tusk","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bonndan/tusk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonndan%2Ftusk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonndan%2Ftusk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonndan%2Ftusk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonndan%2Ftusk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bonndan","download_url":"https://codeload.github.com/bonndan/tusk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bonndan%2Ftusk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33031097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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":["groovy","php-source","transpiler"],"created_at":"2025-01-11T01:14:40.123Z","updated_at":"2026-05-14T15:31:13.473Z","avatar_url":"https://github.com/bonndan.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tusk\n\n[![Build Status](https://travis-ci.org/bonndan/tusk.svg?branch=master)](https://travis-ci.org/bonndan/tusk)\n[![Dependency Status](https://gemnasium.com/badges/github.com/bonndan/tusk.svg)](https://gemnasium.com/github.com/bonndan/tusk)\n[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.0-8892BF.svg)](https://php.net/)\n\nTusk is an experimental transpiler to convert PHP sources into http://groovy-lang.org/. \nIn order to accomplish this it creates an AST using https://github.com/nikic/PHP-Parser and then attempts to write\nthe nodes in Groovy syntax.\n\n## Goal\n\nTusk is meant as support tool to port PHP projects to Groovy/Java with low efforts. It does not\naim at full-auto magic conversion, but aims to create mostly error-free Groovy sources\nenriched with hints. Then with a decent IDE missing things can be quickly resolved.\n\n## Features\n\nPHP source:\n![screenshot](https://raw.githubusercontent.com/bonndan/tusk/master/doc/user_php.png \"PHP source\")\n\nGroovy outuput\n![screenshot](https://raw.githubusercontent.com/bonndan/tusk/master/doc/user_groovy.png \"Groovy source\")\n\n* converts php expressions into valid Groovy\n* handles incompatibilites as far as possible (e.g. \"break 2\")\n* evaluates type information gathered by PHP-Parser and tries to find equivalents\n* uses DocBlock type information where available\n* convert some builtin php functions with Groovy equivalents (e.g. isset)\n* add automatic custom imports\n* add on demand imports of non-resolvable classes via mapping\n\n## Configuration\n\n```php\n\nrequire './vendor/autoload.php';\nini_set('xdebug.max_nesting_level', 3000);\n\n$t = new \\Tusk\\Tusk(Tusk\\Configuration::create(\n    [\n        'source' =\u003e dirname(__DIR__) . '/mylegacyproject',\n        'target' =\u003e dirname(__DIR__) . '/myshinynewgroovyproject',\n        'namespaces' =\u003e [\n            'src' =\u003e '__AUTO__',\n            \n            //folder actions go into package Shiny.Actions\n            'actions' =\u003e 'Shiny.Actions',\n            //include files go into package Shiny.Common\n            'include' =\u003e 'Shiny.Common',\n        ],\n        \n        //these folders are copied into the resources dir\n        'resources' =\u003e [\n            'templates' =\u003e 'templates',\n            'languages' =\u003e 'languages',\n        ],\n        \n        //the docs folder is copied into a new dir documentation\n        'other' =\u003e [\n            'docs' =\u003e 'documentation'\n        ],\n        \n        //if these class names appear, import statements are added\n        'onDemandImport' =\u003e [\n            'Controller' =\u003e 'Shiny.Controller',\n            'DatabaseInterface' =\u003e 'Shiny.DatabaseInterface',\n            'Event' =\u003e 'Shiny.Event',\n            'Base' =\u003e 'Shiny.Base',\n            'Pagination' =\u003e 'Shiny.Pagination',\n        ],\n        \n        //\n        'replaceNames' =\u003e [\n            //use function \u003e import static\n            'between' =\u003e 'Shiny.functions.between', \n            'valNum' =\u003e 'Shiny.functions.valNum',\n            \n            //simple name replacement, here a constant\n            'DIR_SEPERATOR' =\u003e \"'/'\",\n        ]\n    ]\n));\n\n$t-\u003erun();\n```\n\n## Challenges\n\n* arrays. It's hard to find out whether a PHP array can be translated into a Collection, Array or Map or won't work.\n* PHP built-in functions need to be rewritten in Java or Groovy or replaced with equivalents.\n* garbage like \"goto\"\n* fancy stuff like yield, destructors, magic methods and constants\n* casting precedence of objects (non-scalar) not regarded yet\n* use eachwithindex if loop does not contain: break, continue, return\n* prevent useless casting: if ((int) id \u003e 0) where id is already int\n* simplify boolean comparison: \"false==\" or \"true==\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbonndan%2Ftusk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbonndan%2Ftusk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbonndan%2Ftusk/lists"}