{"id":15284318,"url":"https://github.com/siguici/phun","last_synced_at":"2025-10-23T23:23:49.943Z","repository":{"id":229365679,"uuid":"776547696","full_name":"siguici/phun","owner":"siguici","description":"PHP 💙 Bun","archived":false,"fork":false,"pushed_at":"2025-04-15T00:49:47.000Z","size":31,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-15T12:39:32.933Z","etag":null,"topics":["bun","php","phun"],"latest_commit_sha":null,"homepage":"https://npm.im/phun","language":"TypeScript","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/siguici.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null}},"created_at":"2024-03-23T20:08:09.000Z","updated_at":"2025-07-18T18:11:08.000Z","dependencies_parsed_at":"2024-10-14T14:42:00.764Z","dependency_job_id":"3b50b796-9351-40be-ab54-f441d2570667","html_url":"https://github.com/siguici/phun","commit_stats":null,"previous_names":["siguici/phun"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/siguici/phun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Fphun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Fphun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Fphun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Fphun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siguici","download_url":"https://codeload.github.com/siguici/phun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siguici%2Fphun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007457,"owners_count":26084313,"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-10-11T02:00:06.511Z","response_time":55,"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":["bun","php","phun"],"created_at":"2024-09-30T14:53:14.579Z","updated_at":"2025-10-11T14:31:48.732Z","avatar_url":"https://github.com/siguici.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP 💙 Bun (Phun)\n\nPhun offers a seamless PHP integration for JavaScript/TypeScript projects, powered by Bun.\nIt's a great choice, especially if you prefer PHP over JSX/TSX.\n\n## 📋 Requirements\n\nEnsure you have the following installed:\n\n- [**PHP**](https://www.php.net/downloads): Required for executing PHP code.\n\n- [**Bun**](https://bun.sh/docs/installation): Needed for efficient PHP subprocess execution.\n\n## ⚡️Installation\n\nTo install Phun, execute the following command with [Bun](https://bun.sh):\n\n```shell\nbun add phun\n```\n\n## 🔧 Configuration\n\nConfigure Phun in your project by defining the files to import in [the Bun preload file](https://bun.sh/docs/runtime/bunfig#preload):\n\n```typescript\nimport { setup } from \"phun\";\n\nsetup();\n```\n\n## 📖 Usage\nPhun provides multiple ways to incorporate PHP code into your JavaScript/TypeScript projects.\n\n### Rendering PHP Code\n\n  You can render PHP code directly using the `render()` function:\n\n  ```typescript\n  import { render } from 'phun';\n\n  const result = await render(`\u003c?= \"Hello, $name!\" ?\u003e`, { name: 'Sigui' });\n\n  console.log(result); // Output: Hello, Sigui!\n  ```\n\n### Importing PHP Modules\n\n  You can import and use PHP modules in your JavaScript/TypeScript projects:\n\n  ```typescript\n  import my_php_module from \"my/php/module.php\";\n\n  console.log(my_php_module());\n  ```\n\n### Dynamic Using with Data\n\n  You can pass data to PHP code for dynamic rendering using the `use()` function:\n\n  ```typescript\n\n  import { use } from \"phun\";\n\n  const my_php_module = await use(import.meta.dir + '/my/php/module.php', { name: \"Sigui\", username: \"siguici\" });\n\n  console.log(my_php_module);\n```\n\n## 👏 Contributions\n\nContributions are welcome! You can:\n\n- **Open Issues**: Report bugs or suggest improvements.\n  \n- **Submit Pull Requests**: Contribute bug fixes, new features, or documentation enhancements.\n  \n- **Provide Feedback**: Share your thoughts and ideas to help improve Phun.\n\nLet's collaborate and make Phun even more awesome together!\n\n## 📄 License\n\nThis project is licensed under the MIT License. [See the LICENSE file for more details](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiguici%2Fphun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiguici%2Fphun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiguici%2Fphun/lists"}