{"id":22085964,"url":"https://github.com/zmotrin/php-static-autobuilder","last_synced_at":"2025-10-20T02:19:37.695Z","repository":{"id":238344438,"uuid":"796361377","full_name":"ZmotriN/php-static-autobuilder","owner":"ZmotriN","description":"Windows PHP Static Autobuilder to create PHP standalone applications","archived":false,"fork":false,"pushed_at":"2024-06-06T14:44:11.000Z","size":299,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-01T13:43:38.491Z","etag":null,"topics":["autobuilder","build","embed","exe","packed","php","php8","sapi","standalone","static","wcli","win32std","winbinder","windows"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZmotriN.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2024-05-05T18:00:33.000Z","updated_at":"2025-03-29T16:43:48.000Z","dependencies_parsed_at":"2024-06-04T00:08:08.527Z","dependency_job_id":null,"html_url":"https://github.com/ZmotriN/php-static-autobuilder","commit_stats":null,"previous_names":["zmotrin/php-static-autobuilder"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ZmotriN/php-static-autobuilder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-static-autobuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-static-autobuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-static-autobuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-static-autobuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZmotriN","download_url":"https://codeload.github.com/ZmotriN/php-static-autobuilder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZmotriN%2Fphp-static-autobuilder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266878572,"owners_count":23999619,"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-07-24T02:00:09.469Z","response_time":99,"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":["autobuilder","build","embed","exe","packed","php","php8","sapi","standalone","static","wcli","win32std","winbinder","windows"],"created_at":"2024-12-01T01:17:23.502Z","updated_at":"2025-10-20T02:19:32.639Z","avatar_url":"https://github.com/ZmotriN.png","language":"PHP","readme":"# PHPSAB - PHP Static Autobuilder\n\n![PHP Version](https://img.shields.io/badge/PHP-8.3.8-858eb7)\n![Builder](https://img.shields.io/badge/vs16-x64-a679dd)\n![PHPSAB Version](https://img.shields.io/badge/Version-0.1.2-blue)\n![Status](https://img.shields.io/badge/Status-Active-green)\n\n\nPHP Static Autobuilder is script that let you build static single PHP Embed SAPI application for Windows. It take care of download, compile and install PHP and all of its dependencies for you.\n\n## Warning!\nEffin' Windows Defender don't like Embed SAPI. If you get a warning, ignore it. There is no Trojan Horse. All the code is open soure.\n\n## Prerequisites\n- Windows 10 or newer\n- [Visual C++ 16.0 (Visual Studio 2019)](https://visualstudio.microsoft.com/vs/older-downloads/)\n- [Strawberry Perl](https://strawberryperl.com/)\n- [Git](https://git-scm.com/download/win)\n\n## Install\n1.  Download the latest [binary release](https://github.com/ZmotriN/php-static-autobuilder/releases).\n2.  Extract phpsab.exe in a simple path like \"c:\\php-sdk\\phpsab.exe\".\n3.  Open phpsab.exe by doubleclicking on it or run it by cmd.\n4.  Wait until all dependancies are downloaded and compiled.\n5.  See the \"build\" folder.\n\n## Configuration\nYou can create your own configuration in the \"config/\" folder.\\\nExample:\n```ini\n[build]\ntarget = \"php-static.exe\" ; Name of target exe file\nbootstrap = \"phpinfo\" ; Bootstrap (see master/bootstrap folder)\nclean = false ; Always performs a clean build\n\n[extensions]\n\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n; Windows legacy extensions ;\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\nwin32std = Yes ; Mandatory (for res:// stream protocol)\nwinbinder = Yes ; Windows Interface native support\nwcli = Yes ; Windows CLI native support\n\n\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n; Windows built-in extensions ;\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n; ffi = Yes\n; com_dotnet = Yes\n; readline = Yes\n```\nFor the full list of supported extensions, see [config.full.ini](https://github.com/ZmotriN/php-static-autobuilder/blob/main/config.full.ini)\n\n### Usage\n```shell\n\u003e phpsab \u003cconfigname\u003e [test | clean]\n```\n- configname: the filename of the configuration file without .ini\n- test: (optional) to test your configuration without compiling PHP\n- clean: (optional) to create a clean build\n\n\n## Costum matrix file\nIf you want to work with a costum matrix, copy the file \"master/matrix.json\" in the root folder. PHPSAB will check for offline matrix before scrap it from github.\n\n\n## Troubleshooting\nIf you get a compiling error, before opening an issue, try a clean build.\n```shell\n\u003e phpsab configname clean\n```\nIf the error persists, open an issue with the appropriate log file. Any issue without log file will be rejected.\n\n## How does it works\nAfter building the static embed libraries, PHPSAB use them to create a very simple program that include the embed SAPI and execute the content of the resource \"res:///PHP/RUN\". The res stream protocol is provided by win32std extension. So that's where we put the PHP application bootstrap or the PHAR archive. Look at the \"master/bootstrap\" folder for simple examples.\n\n\n## Create standalone application\nOnce you have a functionnal static php,  you have multiple options to create your standalone single file application.\n\n- [Phar-composer](https://github.com/clue/phar-composer) is a simple phar creation for any project managed via Composer.\n- [Embeder2](https://github.com/crispy-computing-machine/embedder2) is a command line program to add resources to your .exe file.\n- res_set() is a function provided by [win32std](http://wildphp.free.fr/wiki/doku.php?id=win32std:index) extension to add resources to your .exe file.\nExample:\n```php\n\u003c?php\n$release = __DIR__ . '\\php-static.exe';\n$contents = file_get_contents(__DIR__ . '\\test.phar');\nvar_dump(res_set($release, 'PHP', 'RUN', $contents));\n```\n\n## Winbinder + GD\nPHPSAB contains a modified version of [Winbinder](https://github.com/ZmotriN/Winbinder-PHP8) with a lot of new features like drag \u0026 drop files, access WMI etc. Originaly, Winbinder uses Freeimage.dll to process images but PHPSAB now provide a bridge to use built-in static GD instead. Example:\n```php\n\u003c?php\n\n// Create window and image frame\ndefine('IDC_IMAGE', 1001);\n$win = wb_create_window(null, AppWindow, 'GD Winbinder', WBC_CENTER, WBC_CENTER, 220, 220, 0x00000000, 0);\n$frame = wb_create_control($win, Frame, '', 10, 10, 200, 200, IDC_IMAGE, 0x00000004, 0, 0);\n\n\n// Load PNG image with GD\n$im = imagecreatefrompng(__DIR__.\"\\\\gd-logo.png\");\n\n// Convert GD image into BITMAP24 matrix\n$matrix = imagegetbitmap24($im);\n\n// Get variable address\n$ptr = wb_get_address($matrix);\n\n// Create a WB Image with the BMP matrix\n$img = wb_create_image(imagesx($im), imagesy($im), $ptr + GD_BITMAP24_HEADER, $ptr + GD_BITMAP24_BITS);\n\n// Destroy GD image\nimagedestroy($im);\nunset($matrix);\n\n// Apply the image to the image frame\nwb_set_image($frame, $img);\n\n\n// Main loop\nwb_main_loop();\n```\n\n## License\nThe scripts and documentation in this project are released under the [MIT License](https://github.com/ZmotriN/php-static-autobuilder/blob/main/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmotrin%2Fphp-static-autobuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzmotrin%2Fphp-static-autobuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzmotrin%2Fphp-static-autobuilder/lists"}