{"id":32514384,"url":"https://github.com/nititech/vite-plugin-php-components","last_synced_at":"2026-04-29T16:07:05.626Z","repository":{"id":320727167,"uuid":"1083061103","full_name":"nititech/vite-plugin-php-components","owner":"nititech","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-29T19:57:13.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-29T21:34:05.261Z","etag":null,"topics":["php","php-framework","php-library","vite","vite-php","vite-plugin","web","webdev","webdevelopment"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vite-plugin-php-components","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/nititech.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-25T09:08:53.000Z","updated_at":"2026-03-29T19:57:17.000Z","dependencies_parsed_at":"2025-10-25T15:06:20.701Z","dependency_job_id":null,"html_url":"https://github.com/nititech/vite-plugin-php-components","commit_stats":null,"previous_names":["nititech/vite-plugin-php-components"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nititech/vite-plugin-php-components","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nititech%2Fvite-plugin-php-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nititech%2Fvite-plugin-php-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nititech%2Fvite-plugin-php-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nititech%2Fvite-plugin-php-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nititech","download_url":"https://codeload.github.com/nititech/vite-plugin-php-components/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nititech%2Fvite-plugin-php-components/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32432991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["php","php-framework","php-library","vite","vite-php","vite-plugin","web","webdev","webdevelopment"],"created_at":"2025-10-27T23:42:16.826Z","updated_at":"2026-04-29T16:07:05.614Z","avatar_url":"https://github.com/nititech.png","language":"TypeScript","funding_links":["https://ko-fi.com/Y8Y2ALMG","https://www.buymeacoffee.com/donnikitos","https://www.paypal.com/donate/?hosted_button_id=EPXZPRTR7JHDW"],"categories":[],"sub_categories":[],"readme":"# vite-plugin-php-components\n\n[![npm](https://img.shields.io/npm/dt/vite-plugin-php-components?style=for-the-badge)](https://www.npmjs.com/package/vite-plugin-php-components) ![GitHub Repo stars](https://img.shields.io/github/stars/nititech/vite-plugin-php-components?label=GitHub%20Stars\u0026style=for-the-badge) [![GitHub](https://img.shields.io/github/license/nititech/vite-plugin-php-components?color=blue\u0026style=for-the-badge)](https://github.com/nititech/vite-plugin-php-components/blob/master/LICENSE)\n![GitHub last commit](https://img.shields.io/github/last-commit/nititech/vite-plugin-php-components?style=for-the-badge) [![Issues](https://img.shields.io/github/issues/nititech/vite-plugin-php-components?style=for-the-badge)](https://github.com/nititech/vite-plugin-php-components/issues)\n\nA Vite plugin to transpile [PHP-Components](https://packagist.org/packages/nititech/html-components) into pure PHP calls.\\\nThis plugin is intended to be used with [vite-plugin-php@\u003e=3.0.0-beta](https://www.npmjs.com/package/vite-plugin-php) and [PHP-Components](https://packagist.org/packages/nititech/html-components)\n\n```ts\n// vite.config.js\nimport { defineConfig } from 'vite';\nimport usePHP from 'vite-plugin-php';\nimport transpilePHPComponents from 'vite-plugin-php-components';\n\nexport default defineConfig({\n\tplugins: [\n\t\ttranspilePHPComponents(), // This plugin must be defined before the vite-plugin-php call\n\t\tusePHP(),\n\t],\n});\n```\n\n## What does this plugin do?\n\nThe [PHP-Components](https://packagist.org/packages/nititech/html-components) package on Packagist allows you to define class based components, similar to those in React.\\\nThis plugin transpiles these HTML or React like structured components into the appropriate PHP class calls.\n\nIn the end you would have something like this in your code base:\n\n```php\n\u003c?/* Some *.php file */?\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\t\u003chead\u003e\n\t\t\u003cmeta charset=\"UTF-8\" /\u003e\n\t\t\u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /\u003e\n\t\t\u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n\t\u003c/head\u003e\n\t\u003cbody\u003e\n\t\t\u003clayouts.Centered\n\t\t\tlabel=\"O-la-la\"\n\t\t\tsearch=\"\u003c?= $_GET['search']; ?\u003e\"\u003e\n\t\t\t\u003ca href=\"/\"\u003e\n\t\t\t\t\u003ccomponents.Button\u003e\n\t\t\t\t\tGo to home\n\t\t\t\t\u003c/components.Button\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/layouts.Centered\u003e\n\t\u003c/body\u003e\n\u003c/html\u003e\n```\n\nThis code will be transpiled during dev and build into code similar to this:\n\n```php\n\u003c?/* Some *.php file */?\u003e\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\t\u003chead\u003e\n\t\t\u003cmeta charset=\"UTF-8\" /\u003e\n\t\t\u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /\u003e\n\t\t\u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n\t\u003c/head\u003e\n\t\u003cbody\u003e\n\t\t\u003c?php $c_1760322029416 = new \\layouts\\Centered(['label' =\u003e 'O-la-la', 'search' =\u003e $_GET['search']]); ?\u003e\n\t\t\t\u003ca href=\"/\"\u003e\n\t\t\t\t\u003c?php $c_1759963459668 = new \\components\\Button([]); ?\u003e\n\t\t\t\t\tGo to home\n\t\t\t\t\u003c?php $c_1759963459668-\u003eclose(); ?\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c?php $c_1760322029416-\u003eclose(); ?\u003e\n\t\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Props spreading\n\nSince version 0.0.92 you have the possibility to spread props into a component!\n\n```php\n\u003ccomponents.Button\n\t...=\"\u003c?= ['type' =\u003e 'submit', 'class' =\u003e 'mx-auto']; ?\u003e\"\u003e\n\tNoice!\n\u003c/components.Button\u003e\n```\n\nThis is especially useful if you want to pass down properties from a parent component:\n\n```php\n\u003c?php\n\nnamespace components;\n\nclass StyledButton extends \\HTML\\Component {\n\tpublic function render() {\n\t?\u003e\n\t\u003ccomponents.Button\n\t\t...=\"\u003c?= $this-\u003e__props__(['*', '!class']); ?\u003e\"\n\t\tclass=\"some-fancy-styling\"\u003e\n\t\t\u003c?= $this-\u003echildren; ?\u003e\n\t\u003c/components.Button\u003e\n\t\u003c?php\n\t}\n}\n```\n\n## Configuration\n\nThis plugin automatically checks if you have installed [PHP-Components](https://packagist.org/packages/nititech/html-components) via Packagist.\\\n⚠️ If not: it will throw an error and stop the dev server/ build process.\n\nYou can disable this check:\n\n```ts\ntranspilePHPComponents({\n\tskipLibCheck: true,\n});\n```\n\n## Support\n\nLove open source? Enjoying my project?\\\nYour support can keep the momentum going! Consider a donation to fuel the creation of more innovative open source software.\n\n| via Ko-Fi                                                                         | Buy me a coffee                                                                                                                                                 | via PayPal                                                                                                                                                             |\n| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Y8Y2ALMG) | \u003ca href=\"https://www.buymeacoffee.com/donnikitos\" target=\"_blank\"\u003e\u003cimg src=\"https://nititech.de/donate-buymeacoffee.png\" alt=\"Buy Me A Coffee\" width=\"174\"\u003e\u003c/a\u003e | \u003ca href=\"https://www.paypal.com/donate/?hosted_button_id=EPXZPRTR7JHDW\" target=\"_blank\"\u003e\u003cimg src=\"https://nititech.de/donate-paypal.png\" alt=\"PayPal\" width=\"174\"\u003e\u003c/a\u003e |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnititech%2Fvite-plugin-php-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnititech%2Fvite-plugin-php-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnititech%2Fvite-plugin-php-components/lists"}