{"id":22415128,"url":"https://github.com/abertschi/graalphp","last_synced_at":"2025-04-09T14:14:15.705Z","repository":{"id":37665893,"uuid":"243288155","full_name":"abertschi/graalphp","owner":"abertschi","description":"An efficient PHP implementation built on GraalVM ","archived":false,"fork":false,"pushed_at":"2022-12-08T11:30:31.000Z","size":23609,"stargazers_count":292,"open_issues_count":27,"forks_count":11,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-02T07:41:47.608Z","etag":null,"topics":["graalvm","php","truffle"],"latest_commit_sha":null,"homepage":"https://abertschi.ch/blog/2020/building-graalphp/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abertschi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-26T14:51:47.000Z","updated_at":"2025-02-11T17:56:47.000Z","dependencies_parsed_at":"2023-01-25T05:31:25.186Z","dependency_job_id":null,"html_url":"https://github.com/abertschi/graalphp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abertschi%2Fgraalphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abertschi%2Fgraalphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abertschi%2Fgraalphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abertschi%2Fgraalphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abertschi","download_url":"https://codeload.github.com/abertschi/graalphp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"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":["graalvm","php","truffle"],"created_at":"2024-12-05T15:11:19.485Z","updated_at":"2025-04-09T14:14:15.673Z","avatar_url":"https://github.com/abertschi.png","language":"Java","readme":"[![Build Status](https://travis-ci.com/abertschi/graalphp.svg?branch=master)](https://travis-ci.com/abertschi/graalphp)\n[![codebeat badge](https://codebeat.co/badges/2fc3ffd8-52b2-493b-a7fd-7f0faebe8c78)](https://codebeat.co/projects/github-com-abertschi-graalphp-master)\n[![CodeFactor](https://www.codefactor.io/repository/github/abertschi/graalphp/badge)](https://www.codefactor.io/repository/github/abertschi/graalphp)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0f1a558135e241aeb94b650db93ff714)](https://www.codacy.com/manual/abertschi/graalphp?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=abertschi/graalphp\u0026amp;utm_campaign=Badge_Grade)\n\n# A PHP implementation built on GraalVM\n\u003e Graalphp is an experimental just-in-time (JIT) compiler and runtime\nfor PHP 7.4+ hosted on GraalVM.\n\n### Abstract\n  PHP is a popular, weakly typed, general purpose programming\n  language. Originally designed for building dynamic web pages, the\n  language has since gained wide adoption in server-side web\n  development.  In this work, we describe the design and\n  implementation of graalphp, an experimental compiler and\n  runtime for PHP hosted on Truffle and GraalVM. GraalVM is a virtual\n  machine that supports execution of multiple languages, which are\n  implemented as Abstract Syntax Tree (AST) interpreters based on\n  Truffle. GraalVM uses Graal as its JIT compiler to compile\n  frequently executed code fragments to machine code.  We implement a\n  subset of the PHP language to run synthetic benchmarks by\n  The Computer Language Benchmarks Game. We compare peak\n  performance of our implementation against PHP 7 as well as\n  alternative implementations such as HHVM, JPHP and an early alpha\n  version of PHP 8. Experimental results indicate that our runtime\n  reaches competitive results with performance gains of up to 859%\n  compared to PHP 7. These preliminary results\n  suggest that a Truffle-hosted PHP implementation might be\n  significantly faster than existing language implementations.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./benchmarks/evaluation/assets/report/image_2020-09-06_12-36-43.png\" alt=\"design\" width=\"600\"/\u003e\n\u003c/p\u003e\n\n- Benchmarks: [./results.md/](./results.md/)\n- [Download Report](https://abertschi.ch/default_public/ethz/graalphp/download.php)  \n- Presentation: https://www.youtube.com/watch?v=Dzahabn8ojo\n\nThis project was launched as an undergraduate thesis at ETHZ.\n\n### Build and Run\nFor a container image with development and benchmark dependencies see\n[./docker/](./docker/).\n\n```shell\n# Build Dependencies: Linux environment, maven, ant, GraalVM\n# download GraalVM from https://github.com/graalvm/graalvm-ce-builds/releases\n$ export JAVA_HOME=/path/to/graalvm\n$ mvn package\n$ ./graalphp \u003cphp-file.php\u003e\n```\n\n```sh\n# build native image:\n$ export JAVA_HOME=/path/to/graalvm\n$ $JAVA_HOME/bin/gu install native-image\n$ export GRAALPHP_BUILD_NATIVE=\"true\"\n$ mvn package\n```\n\n### Feature Set\nHigh Level Overview of implemented features, current runtime code\nbase. ca. 4000 LOC. Implemented features are chosen to support execution of the Computer Language Benchmark Game.\nhttps://github.com/abertschi/graalphp/tree/master/benchmarks/evaluation\n  \nNon exhaustive list of features:\n+ Datatypes: int, float, boolean, arrays (sequences) of these types\n+ Unconditionally defined functions\n+ Variables in function scope, global scope\n+ Binary, unary, operations\n+ while, do while, for, if\n\n\n### More Resources\n- Graal Github Issue for PHP support :: https://github.com/oracle/graal/issues/361\n- GraalVM :: https://graalvm.org\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabertschi%2Fgraalphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabertschi%2Fgraalphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabertschi%2Fgraalphp/lists"}