{"id":29419724,"url":"https://github.com/beastbytes/form-latte","last_synced_at":"2025-07-12T01:03:33.140Z","repository":{"id":276859241,"uuid":"927691693","full_name":"beastbytes/form-latte","owner":"beastbytes","description":"Integration of Yii Framework Form package with view-latte Latte Template Renderer","archived":false,"fork":false,"pushed_at":"2025-06-04T22:30:27.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-05T03:23:44.293Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beastbytes.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":"2025-02-05T11:36:16.000Z","updated_at":"2025-06-04T22:30:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"ba853135-3039-4cf0-ac6e-e83a3629317b","html_url":"https://github.com/beastbytes/form-latte","commit_stats":null,"previous_names":["beastbytes/view-latte-form"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beastbytes/form-latte","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fform-latte","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fform-latte/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fform-latte/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fform-latte/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beastbytes","download_url":"https://codeload.github.com/beastbytes/form-latte/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beastbytes%2Fform-latte/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922787,"owners_count":23683691,"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":[],"created_at":"2025-07-12T01:02:13.525Z","updated_at":"2025-07-12T01:03:30.642Z","avatar_url":"https://github.com/beastbytes.png","language":"PHP","readme":"Form Latte is a [Latte](https://latte.nette.org/) [extension](https://latte.nette.org/en/creating-extension) \nthat integrates the Yii 3 [Form Model package](https://github.com/yiisoft/form-model) with \n[`view-latte`, a Latte Template View Renderer for Yii3](https://github.com/beastbytes/view-latte).\n\n## Requirements\n- PHP 8.1 or higher.\n\n## Installation\nInstall the package using [Composer](https://getcomposer.org):\n\nEither:\n```shell\ncomposer require beastbytes/form-latte\n```\nor add the following to the `require` section of your `composer.json`\n```json\n\"beastbytes/form-latte\": \"{version constraint}\"\n```\n\n## Configuration\nTo configure Latte to use the extension add it to the `extensions` key of `beastbytes/view-latte` in the params\nof your configuration.\n\n```php\n'beastbytes/view-latte' =\u003e [\n    // filters and functions\n    'extensions' =\u003e [\n        new BeastBytes\\View\\Latte\\Form\\FormExtension(),\n    ]\n],\n```\n\n## Description\nThe extension adds tags to Latte for form fields (including errorSummary), and the form and fieldset HTML tags.\nThe extension follows the conventions of the Form Model package, in that form fields are specified with the form model,\nfield parameter, and optionally a theme;\nall other options are specified in the field configuration using Latte's filter syntax;\nwhere an option takes a value, the value is the same as for the equivalent form model field type. \n\n### Form Fields\nForm field tags can have the same names as the Yii fields or HTML fields, e.g. 'text', 'email', etc.;\n'tel' or 'telephone' can be used, as can 'submit' or 'submitButton', and 'reset' or 'resetButton'.\n\n## Usage\nWrite forms in Latte templates using the tags and configuration \"filters\" defined by the extension.\n\nA form input has the pattern:\n```latte\n{tag $formModel, 'parameter'|config1|config2|...|configN}\n```\n\nA form button has the pattern:\n```latte\n{button |config}Content{/button}\n```\n\nA button group has the pattern:\n```latte\n{buttonGroup}\n{button|attributes:[k=\u003ev]}Button 1{/button}\n{button|attributes:[k=\u003ev]}Button 1{/button}\n...\n{button|attributes:[k=\u003ev]}Button n{/button}\n{/buttonGroup}\n```\n**NOTE:** In a buttonGroup, `attributes` is the only allowed configuration for the button tag.\n**Note:** The buttonGroup tag has the `encode` configuration which takes a boolean value (default `true`) to determine\nif button content is HTML encoded.\n\n### Example 1\nLogin form\n```latte\n{form $action|csrf:$csrf}\n    {email $formModel, 'email'|required|tabIndex}\n    {password $formModel, 'password'|required|tabIndex}\n    {submitButton}Login{/submitButton}\n{/form}\n```\n\n### Example 2\nA form to collect a person's name, email, address, phone number, and agreement to terms:\n```latte\n{form $action|csrf:$csrf}\n    {errorSummary $formModel|onlyFirst}\n    {text $formModel, 'givenName'|tabIndex}\n    {text $formModel, 'familyName'|required|tabIndex}\n    {email $formModel, 'email'|required|tabIndex}\n    {text $formModel, 'streetAddress'|required|tabIndex}\n    {text $formModel, 'locality'|required|tabIndex}\n    {text $formModel, 'region'|required|tabIndex}\n    {text $formModel, 'postalCode'|required|tabIndex}\n    {select $formModel, 'country'|required|tabIndex|optionsData:$countries}\n    {tel $formModel, 'telephone'|required|tabIndex}\n    {checkbox $formModel, 'agree'|tabIndex}\n    {submit}Submit{/submit}\n{/form}\n```\n\n### Extra Features\nThe package adds some extra features that make developing a form even easier.\n\n* **Field enrichment**: If you use field enrichment - setting options based on validation rules, e.g. `required`,\njust add the `enrich` option. Yii's Field Enricher is used by default, but you can specify your own.\n```latte\n  {text $formModel, 'familyName'|enrich} {* use the default enricher *}\n  {text $formModel, 'familyName'|enrich:$myEnricher} {* use $myEnricher *}\n```\n* **Tab Index**: If no value is given with the tabIndex option the package will auto index the fields.\nYou can pass a value if you want to. **NOTE** do not mix auto indexing and self indexing in a form.\n```latte\n    {* Auto indexing *}\n    {text $formModel, 'givenName'|tabIndex}\n    {text $formModel, 'familyName'|tabIndex}\n```\n```latte\n    {* Self indexing *}\n    {text $formModel, 'givenName'|tabIndex:1}\n    {text $formModel, 'familyName'|tabIndex:2}\n```\n\n## IDE Support\n### JetBrains PhpStorm\nInstall the [Latte Support](https://plugins.jetbrains.com/plugin/24218-latte-support) plugin.\nEither copy the `latte.xml` file (in the root directory of this package) to the `.idea` directory of your project\nor merge with an existing `latte.xml`.\n\n## License\nThe BeastBytes View Latte Form package is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastbytes%2Fform-latte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeastbytes%2Fform-latte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeastbytes%2Fform-latte/lists"}