{"id":14987360,"url":"https://github.com/kenjis/ci4-viewi-demo","last_synced_at":"2025-04-12T00:02:54.847Z","repository":{"id":61471915,"uuid":"551341896","full_name":"kenjis/ci4-viewi-demo","owner":"kenjis","description":"CodeIgniter4 Viewi Demo","archived":false,"fork":false,"pushed_at":"2024-04-02T10:27:50.000Z","size":803,"stargazers_count":16,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-12T00:02:46.276Z","etag":null,"topics":["codeigniter","codeigniter4","viewi"],"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/kenjis.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}},"created_at":"2022-10-14T08:13:37.000Z","updated_at":"2025-04-09T10:22:51.000Z","dependencies_parsed_at":"2024-09-24T15:44:18.925Z","dependency_job_id":"e20d5c07-1493-49a4-9105-72de6df099ff","html_url":"https://github.com/kenjis/ci4-viewi-demo","commit_stats":{"total_commits":61,"total_committers":2,"mean_commits":30.5,"dds":"0.24590163934426235","last_synced_commit":"8ff005c4a2536ba7346a0c0c6aecfa9735bc99b1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-viewi-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-viewi-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-viewi-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjis%2Fci4-viewi-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenjis","download_url":"https://codeload.github.com/kenjis/ci4-viewi-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497803,"owners_count":21113984,"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":["codeigniter","codeigniter4","viewi"],"created_at":"2024-09-24T14:14:30.209Z","updated_at":"2025-04-12T00:02:54.768Z","avatar_url":"https://github.com/kenjis.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeIgniter4 Viewi Demo\n\n\u003e Viewi allows you to create reactive web applications using your favorite PHP.\n\u003e It converts your code into native javascript code to run it in the browser.\n\u003e This way, you get a perfectly rendered HTML page on the first load, and at the\n\u003e same time, your page will remain reactive without requesting each next page on\n\u003e link clicks, etc.\nhttps://viewi.net/\n\n## Installation\n\n```console\ngit clone https://github.com/kenjis/ci4-viewi-demo.git\ncd ci4-viewi-demo/\ncomposer install\n```\n\n## Running Application\n\nAssuming you have done composer install/update.\n\nIn the first terminal:\n```console\ncd app/ViewiApp/js/\n```\n\nInstall NPM packages, if you are running for the first time:\n```console\nnpm install\n```\n\nRun watch mode:\n```console\nnpm run watch\n```\n\nIn the second terminal:\n```console\nphp spark serve\n```\n\nNavigate to \u003chttp://localhost:8080/\u003e.\n\n## Folder Structure\n\n```\n.\n├── app/\n│   ├── ViewiBridge/ ... Adapters for Viewi\n│   └── ViewiApp/    ... Viewi App\n│        ├── Components/\n│        │   ├── Models/\n│        │   ├── Services/\n│        │   └── Views/\n│        ├── build/     ... Do not touch\n│        ├── config.php ... Viewi config file\n│        └── routes.php ... Viewi routes file\n├── public/\n│   └── viewi-build/ ... Do not touch\n```\n\n## How to Code\n\n`app/ViewiApp/Components/Views/Counter/Counter.php`:\n```php\n\u003c?php\n\nnamespace Components\\Views\\Counter;\n\nuse Viewi\\Components\\BaseComponent;\n\nclass Counter extends BaseComponent\n{\n    public int $count = 0;\n\n    public function increment()\n    {\n        $this-\u003ecount++;\n    }\n\n    public function decrement()\n    {\n        $this-\u003ecount--;\n    }\n}\n```\n\n`app/ViewiApp/Components/Views/Counter/Counter.html`:\n```html\n\u003cbutton (click)=\"decrement\" class=\"mui-btn mui-btn--accent\"\u003e-\u003c/button\u003e\n\u003cspan class=\"mui--text-dark mui--text-title\"\u003e$count\u003c/span\u003e\n\u003cbutton (click)=\"increment\" class=\"mui-btn mui-btn--accent\"\u003e+\u003c/button\u003e\n```\n\n## How to Confirm Routes\n\n```console\n$ php spark routes\n\nCodeIgniter v4.4.4 Command Line Tool - Server Time: 2024-02-24 08:15:13 UTC+00:00\n\n+--------+--------------------+------+--------------------------------------+----------------+---------------+\n| Method | Route              | Name | Handler                              | Before Filters | After Filters |\n+--------+--------------------+------+--------------------------------------+----------------+---------------+\n| GET    | api/posts/([0-9]+) | »    | \\App\\Controllers\\Api\\Posts::index/$1 |                | toolbar       |\n+--------+--------------------+------+--------------------------------------+----------------+---------------+\n```\n\nSee `app/ViewiApp/routes.php` for routes by Viewi.\n\n## How Viewi Works with CodeIgniter\n\n[CodeIgniter4 Viewi integration](https://viewi.net/docs/code-igniter)\n\n## References\n\n- https://www.codeigniter.com/\n- https://viewi.net/\n- [CodeIgniter4 Viewi integration](https://viewi.net/docs/code-igniter)\n- [CodeIgniter4 User Guide](https://codeigniter4.github.io/CodeIgniter4/)\n- [CodeIgniter4 Viewi Tour of Heroes app](https://github.com/kenjis/ci4-viewi-tour-of-heroes)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenjis%2Fci4-viewi-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenjis%2Fci4-viewi-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenjis%2Fci4-viewi-demo/lists"}