{"id":15641785,"url":"https://github.com/belgattitude/soluble-japha","last_synced_at":"2025-08-17T10:34:56.629Z","repository":{"id":22780921,"uuid":"26127003","full_name":"belgattitude/soluble-japha","owner":"belgattitude","description":"PHP Java integration","archived":false,"fork":false,"pushed_at":"2023-04-09T20:00:25.000Z","size":4494,"stargazers_count":72,"open_issues_count":4,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-23T17:49:22.048Z","etag":null,"topics":["bridge","client","java","php","php-java-bridge","phpjavabridge"],"latest_commit_sha":null,"homepage":"https://belgattitude.github.io/soluble-japha/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"boulzordev/android_vendor_motorola_potter","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/belgattitude.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2014-11-03T16:14:43.000Z","updated_at":"2025-07-03T14:58:33.000Z","dependencies_parsed_at":"2024-06-18T18:30:38.628Z","dependency_job_id":null,"html_url":"https://github.com/belgattitude/soluble-japha","commit_stats":{"total_commits":809,"total_committers":3,"mean_commits":269.6666666666667,"dds":0.008652657601977753,"last_synced_commit":"45527ddfd9bbc8fbf796f638c084942f2619ef37"},"previous_names":[],"tags_count":72,"template":false,"template_full_name":null,"purl":"pkg:github/belgattitude/soluble-japha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-japha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-japha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-japha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-japha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/belgattitude","download_url":"https://codeload.github.com/belgattitude/soluble-japha/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/belgattitude%2Fsoluble-japha/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270837403,"owners_count":24654374,"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-08-17T02:00:09.016Z","response_time":129,"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":["bridge","client","java","php","php-java-bridge","phpjavabridge"],"created_at":"2024-10-03T11:45:17.952Z","updated_at":"2025-08-17T10:34:56.471Z","avatar_url":"https://github.com/belgattitude.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# soluble-japha\n\n[![PHP Version](https://img.shields.io/badge/php-5.6+-ff69b4.svg)](https://packagist.org/packages/soluble/japha)\n[![PHP Version](https://img.shields.io/badge/php-7.4+-ff69b4.svg)](https://packagist.org/packages/soluble/japha)\n[![PHP Version](https://img.shields.io/badge/php-8.0+-ff69b4.svg)](https://packagist.org/packages/soluble/japha)\n[![Build Status](https://travis-ci.org/belgattitude/soluble-japha.svg?branch=master)](https://travis-ci.org/belgattitude/soluble-japha)\n[![codecov](https://codecov.io/gh/belgattitude/soluble-japha/branch/master/graph/badge.svg)](https://codecov.io/gh/belgattitude/soluble-japha)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/belgattitude/soluble-japha/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/belgattitude/soluble-japha/?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/soluble/japha/v/stable.svg)](https://packagist.org/packages/soluble/japha)\n[![Total Downloads](https://poser.pugx.org/soluble/japha/downloads.png)](https://packagist.org/packages/soluble/japha)\n[![License](https://poser.pugx.org/soluble/japha/license.png)](https://packagist.org/packages/soluble/japha)\n\nIn short **soluble-japha** allows to write Java code in PHP and interact with the JVM ecosystem.\n\n----\n\n\u003e Read the doc on [https://belgattitude.github.io/soluble-japha](https://belgattitude.github.io/soluble-japha)\n\u003e website for complete information\n\n----\n\nAs meaningless examples:\n\n```php\n\u003c?php\n// Some standard JVM classes\n$hashMap = $ba-\u003ejava('java.util.HashMap', [\n        'message' =\u003e 'Hello world',\n        'value'   =\u003e $ba-\u003ejava('java.math.BigInteger', PHP_INT_MAX)\n]);\n$hashMap-\u003eput('message', '你好，世界');\necho $hashMap-\u003eget('message');\n```\n\n-------\n\n```php\n\u003c?php\n\nuse Soluble\\Japha\\Bridge\\Exception;\n\n// An imaginary java library class (i.e. NLP, Android, Jasper, Tensorflow,\n// enterprise stuff, esoteric java lib/driver or your own Java class...)\ntry {\n    $javaLib = $ba-\u003ejava('an.imaginary.JavaLibraryClass', 'param1', 'param2');\n\n    $results = $javaLib-\u003eaMethodOnJavaLibExecutedOnTheJVM(\n                            // Method parameters\n                            $hashMap-\u003eget('message'),\n                            $ba-\u003ejava('java.io.BufferedReader',\n                                 $ba-\u003ejava('java.io.FileReader', __FILE__)\n                            ),\n                            $ba-\u003ejavaClass('java.util.TimeZone')-\u003eSHORT\n                        );\n\n    foreach ($results as $key =\u003e $values) {\n        echo \"$key: \" . $values[0] . PHP_EOL;\n    }\n} catch (Exception\\ClassNotFoundException $e) {\n    echo $e-\u003egetMessage();\n} catch (Exception\\JavaException $e) {\n    echo $e-\u003egetMessage() . ' [' . $e-\u003egetJavaClassName() . ']';\n    echo $e-\u003egetStackTrace();\n}\n\n```\n\nAnd if you're wondering what's the `$ba` object, it's a connection\nto the java bridge server:\n\n```php\n\u003c?php\n\nuse Soluble\\Japha\\Bridge\\Adapter as BridgeAdapter;\nuse Soluble\\Japha\\Bridge\\Exception as BridgeException;\n\n$options = [\n    'servlet_address' =\u003e 'localhost:8080/MyJavaBridge/servlet.phpjavabridge'\n];\n\ntry {\n    $ba = new BridgeAdapter($options);\n} catch (BridgeException\\ConnectionException $e) {\n    // Server is not reachable\n    echo $e-\u003egetMessage();\n}\n```\n\n## Use cases\n\n**Expand the PHP horizons to the Java ecosystem**, especially whenever you want\nto take advantage of\n\n- some compelling libraries *([Jasperreports](http://community.jaspersoft.com/project/jasperreports-library), [CoreNLP](http://stanfordnlp.github.io/CoreNLP/), [FlyingSaucer](https://github.com/flyingsaucerproject/flyingsaucer/releases), [Jsoup](https://jsoup.org/)...)*\n- benefit from JVM performances *([Deeplearning4J](https://deeplearning4j.org/)...)* or wrappers *([TensorFlow Java Api](https://www.tensorflow.org/api_docs/)...)*.\n- when a pure-PHP alternative does not exists *(Android, driver, closed api, enterprise...)*\n- or simply for the fun of it.\n\n\u003e The freedom allowed by `soluble-japha` is not fit for every scenarios.\n\u003e Be sure to read the [considerations](#considerations) and [performance](#performance)\n\u003e sections to learn more.\n\n## Features\n\n`soluble-japha` provides a PHP client to interact with the Java Virtual Machine.\n\n- [x] Write Java code from PHP *(in a similar way from equivalent java code)*.\n- [x] Keep *programmatic* code control from the PHP side *([function oriented vs REST](#considerations))*.\n- [x] Java execution on the JVM ensuring compatibility and efficiency *(proxied objects)*.\n- [x] No need to write a service layer prior to usage *(the Java object is the contract)*.\n- [x] Fast network based communication between runtimes, no JVM startup effort.\n- [x] Solid foundation to create, develop *or publish* PHP wrappers over java libs.\n\n\n\u003e For user of previous versions, **soluble-japha** client replaces the original/legacy [PHPJavaBridge](http://php-java-bridge.sourceforge.net/pjb/)\n\u003e `Java.inc` implementation and has been completely refactored to fit modern practices\n\u003e and PHP7.\n\u003e See the [differences here](./doc/notes_legacy.md) and the [legacy compatibility layer](https://github.com/belgattitude/soluble-japha-pjb62-compat) if needed.\n\n## Requirements\n\n- Version `^3.0` requires PHP 8.0 ![PHP Version](http://img.shields.io/badge/php-8.0+-ff69b4.svg)\n- Version `^2.0` requires PHP 7.1 ![PHP Version](http://img.shields.io/badge/php-7.1+-ff69b4.svg)\n\n\u003e **Important**. There's **NO API BC-BREAK** between v0.13, v1.x, v2.x and v3.x so you should be\n\u003e able to upgrade safely between releases. The choice to increment version numbers to drop\n\u003e support for older php versions was made to avoid any confusion with multiple php installs.\n\n\nIf you're looking for compatibility with older PHP versions, note that:\n\n- Version `^1.0` requires PHP 5.6 ![PHP Version](http://img.shields.io/badge/php-5.6+-ff69b4.svg) and works with HHVM.\n- Version `^0.13` requires PHP 5.5 ![PHP Version](http://img.shields.io/badge/php-5.5+-ff69b4.svg) and works with HHVM.\n\n\n## Documentation\n\n - Go to https://belgattitude.github.io/soluble-japha\n\n## Installation\n\nInstallation in your PHP project **(client)**\n\n```console\n$ composer require soluble/japha\n```\n\n## Considerations\n\n\u003e In short, **the bridge shines** whenever you need to use directly a Java library\n\u003e within a reasonable number of method calls. Otherwise implement\n\u003e **REST or RPC approaches** for first-class system integrations.\n\nThe soluble-japha bridge can be seen as a `function oriented` solution in\ncomparison to `resource oriented` ones *(i.e. REST,...)*. From REST or even\nRPC-based solutions *(XMLRPC, JsonRPC or [gRPC](https://github.com/grpc/grpc))*,\nthe bridge skips the need to write a service layer on\nthe Java side and allows a more *programmatic* approach to PHP developers.\n\nDepending on usage, the benefits of freedom offered by the bridge\ncan become a limitation in term of performance. Keep in mind that\nthe bridge is sensitive to the number of objects and method calls\n(named `roundtrips`) and if few hundreds of methods calls are\noften insignificant (a `roundtrip` is generally less than 0.1ms) going further\nits target scenarios can be disappointing. In those case,\ntraditional approaches like REST should be considered and applied instead.\n\nThat said, the bridge is a good, reliable and sometimes preferable alternative\nover REST for scenarios where a reasonable number of methods calls is intended.\n\nBe sure to read the\n- [http://docs.soluble.io/soluble-japha/bridge_how_it_works/](http://docs.soluble.io/soluble-japha/bridge_how_it_works/)\n- [http://docs.soluble.io/soluble-japha/bridge_benchmarks/](http://docs.soluble.io/soluble-japha/bridge_benchmarks/)\n\n## Support\n\nPlease fill any issues on the [offical tracker](https://github.com/belgattitude/soluble-japha/issues).\nIf you like to contribute, see the [contribution guidelines](https://github.com/belgattitude/soluble-japha/blob/master/CONTRIBUTING.md).\nAll P/R are warmly welcomed.\n\n\n### Credits\n\n* This code is principally developed and maintained by [Sébastien Vanvelthem](https://github.com/belgattitude).\n* Special thanks to [all of these awesome contributors](https://github.com/belgattitude/soluble-japha/network/members)\n* This project is based on the Java.inc work made by the [PHPJavaBridge developers](http://php-java-bridge.sourceforge.net/pjb/contact.php#code_contrib).\n\n### Special mention\n\nGrateful thanks to JetBrains for granting an opensource license of PHPStorm and Idea. Really recommend !!!\n\n[![PHPStorm](./doc/images/phpstorm.svg)](https://www.jetbrains.com)\n\n## Coding standards and interop\n\n* [PSR 4 Autoloader](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md)\n* [PSR 3 Logger interface](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)\n* [PSR 2 Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)\n* [PSR 1 Coding Standards](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelgattitude%2Fsoluble-japha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbelgattitude%2Fsoluble-japha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbelgattitude%2Fsoluble-japha/lists"}