{"id":19458845,"url":"https://github.com/leafsphp/viewi","last_synced_at":"2025-04-25T06:30:36.155Z","repository":{"id":57054047,"uuid":"526764081","full_name":"leafsphp/viewi","owner":"leafsphp","description":"🚦 Viewi PHP integration for your Leaf apps","archived":false,"fork":false,"pushed_at":"2024-08-25T02:03:44.000Z","size":10,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T03:24:51.140Z","etag":null,"topics":["viewi"],"latest_commit_sha":null,"homepage":"https://leafphp.dev/modules/views/viewi/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leafsphp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"open_collective":"leaf","github":"leafsphp"}},"created_at":"2022-08-19T22:09:26.000Z","updated_at":"2024-08-19T19:02:39.000Z","dependencies_parsed_at":"2022-08-24T04:11:48.768Z","dependency_job_id":null,"html_url":"https://github.com/leafsphp/viewi","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/leafsphp%2Fviewi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2Fviewi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2Fviewi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafsphp%2Fviewi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leafsphp","download_url":"https://codeload.github.com/leafsphp/viewi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250141596,"owners_count":21381628,"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":["viewi"],"created_at":"2024-11-10T17:28:42.963Z","updated_at":"2025-04-25T06:30:35.848Z","avatar_url":"https://github.com/leafsphp.png","language":"PHP","readme":"\u003c!-- markdownlint-disable no-inline-html --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cbr\u003e\u003cbr\u003e\n  \u003cimg src=\"https://leafphp.dev/logo-circle.png\" height=\"100\"/\u003e\n  \u003cimg src=\"https://viewi.net/logo.svg\" height=\"100\"/\u003e\n  \u003ch1 align=\"center\"\u003eLeaf Viewi Module\u003c/h1\u003e\n  \u003cbr\u003e\u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/leafs/viewi/v/stable)](https://packagist.org/packages/leafs/viewi)\n[![Total Downloads](https://poser.pugx.org/leafs/viewi/downloads)](https://packagist.org/packages/leafs/viewi)\n[![License](https://poser.pugx.org/leafs/viewi/license)](https://packagist.org/packages/leafs/viewi)\n\nThis module allows you to quickly and easily integrate Viewi into your Leaf apps without any pain at all.\n\n## Installation\n\nYou can easily install Leaf Viewi using the [Leaf CLI](https://cli.leafphp.dev):\n\n```sh\nleaf install viewi\n```\n\nOr with [Composer](https://getcomposer.org/).\n\n```bash\ncomposer require leafs/viewi\n```\n\n## Basic Usage\n\nAfter installing the module, you can setup a `viewi-app/components` folder as prescribed by the Viewi docs. In there you can create your Viewi components. Back in your Leaf entry point, all you need to do is initialize the Leaf Viewi module and add your viewi routes.\n\n```php\n\u003c?php\n\nrequire __DIR__ . '/vendor/autoload.php';\nrequire __DIR__ . '/viewi-app/components/HomePage.php';\n\nviewi()-\u003einit();\n\n// This is a viewi route.\nviewi()-\u003eget('/', HomePage::class);\n\napp()-\u003eget('/something', function () {\n  echo 'This is a Leaf route';\n});\n\napp()-\u003erun();\n```\n\nBy default, the Leaf Viewi module will handle the configuration for Viewi, so you don't need to anything unless you want to use your own setup. In that case, you can pass the Viewi config into `viewi()-\u003einit();`:\n\n```php\n\u003c?php\n\nuse Viewi\\PageEngine;\n\nrequire __DIR__ . '/vendor/autoload.php';\nrequire __DIR__ . '/viewi-app/components/HomePage.php';\n\nviewi()-\u003einit([\n  PageEngine::SOURCE_DIR =\u003e __DIR__ . '/ViewiApp/Components',\n  PageEngine::SERVER_BUILD_DIR =\u003e  __DIR__ . '/ViewiApp/build',\n  PageEngine::PUBLIC_ROOT_DIR =\u003e __DIR__,\n  PageEngine::DEV_MODE =\u003e true,\n  PageEngine::RETURN_OUTPUT =\u003e true,\n  PageEngine::COMBINE_JS =\u003e true\n]);\n\nviewi()-\u003eget('/', HomePage::class);\n\napp()-\u003eget('/something', function () {\n  echo 'This is a Leaf route';\n});\n\napp()-\u003erun();\n```\n\n## Contributing\n\nWe are glad to have you. All contributions are welcome! To get started, familiarize yourself with our [contribution guide](https://leafphp.dev/community/contributing.html) and you'll be ready to make your first pull request 🚀.\n\nTo report a security vulnerability, you can reach out to [@mychidarko](https://twitter.com/mychidarko) or [@leafphp](https://twitter.com/leafphp) on twitter. We will coordinate the fix and eventually commit the solution in this project.\n\n### Code contributors\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://github.com/ivanvoitovych/\"\u003e\n\t\t\t\t\u003cimg src=\"https://avatars.githubusercontent.com/u/9718423?v=4\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003eIvan Voitovych\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://github.com/mychidarko\"\u003e\n\t\t\t\t\u003cimg src=\"https://avatars.githubusercontent.com/u/26604242?v=4\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\n\t\t\t\t\t\u003cb\u003eMichael Darko\u003c/b\u003e\n\t\t\t\t\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n## 🤩 Sponsoring Leaf\n\nYour cash contributions go a long way to help us make Leaf even better for you. You can sponsor Leaf and any of our packages on [open collective](https://opencollective.com/leaf) or check the [contribution page](https://leafphp.dev/support/) for a list of ways to contribute.\n\nAnd to all our existing cash/code contributors, we love you all ❤️\n\n### Cash contributors\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://opencollective.com/aaron-smith3\"\u003e\n\t\t\t\t\u003cimg src=\"https://images.opencollective.com/aaron-smith3/08ee620/avatar/256.png\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003eAaron Smith\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://opencollective.com/peter-bogner\"\u003e\n\t\t\t\t\u003cimg src=\"https://images.opencollective.com/peter-bogner/avatar/256.png\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003ePeter Bogner\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"#\"\u003e\n\t\t\t\t\u003cimg src=\"https://images.opencollective.com/guest-32634fda/avatar.png\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003eVano\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003ca href=\"#\"\u003e\n        \u003cimg\n          src=\"https://images.opencollective.com/guest-c72a498e/avatar.png\"\n          width=\"120px\"\n          alt=\"\"\n        /\u003e\n        \u003cbr /\u003e\n        \u003csub\u003e\u003cb\u003eCasprine\u003c/b\u003e\u003c/sub\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n\t\u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://github.com/doc-han\"\u003e\n\t\t\t\t\u003cimg src=\"https://avatars.githubusercontent.com/u/35382021?v=4\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003eFarhan Yahaya\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\n\t\t\t\u003ca href=\"https://www.lucaschaplain.design/\"\u003e\n\t\t\t\t\u003cimg src=\"https://images.opencollective.com/sptaule/aa5f956/avatar/256.png\" width=\"120px\" alt=\"\"/\u003e\n\t\t\t\t\u003cbr /\u003e\n\t\t\t\t\u003csub\u003e\u003cb\u003eLucas Chaplain\u003c/b\u003e\u003c/sub\u003e\n\t\t\t\u003c/a\u003e\n\t\t\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n","funding_links":["https://opencollective.com/leaf","https://github.com/sponsors/leafsphp","https://opencollective.com/aaron-smith3","https://opencollective.com/peter-bogner"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafsphp%2Fviewi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafsphp%2Fviewi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafsphp%2Fviewi/lists"}