{"id":16702663,"url":"https://github.com/steevanb/symfony-form-options-builder","last_synced_at":"2025-03-17T01:30:52.248Z","repository":{"id":33843926,"uuid":"37546664","full_name":"steevanb/symfony-form-options-builder","owner":"steevanb","description":"FormType::buildForm() with objects instead of array.","archived":false,"fork":false,"pushed_at":"2024-05-09T08:44:06.000Z","size":269,"stargazers_count":0,"open_issues_count":13,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T15:38:08.649Z","etag":null,"topics":["formtype","php","symfony"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steevanb.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","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":"2015-06-16T17:54:59.000Z","updated_at":"2024-05-09T08:43:50.000Z","dependencies_parsed_at":"2024-10-27T11:50:35.665Z","dependency_job_id":"8c609553-d3ae-49cd-b44b-871e13c82552","html_url":"https://github.com/steevanb/symfony-form-options-builder","commit_stats":{"total_commits":175,"total_committers":5,"mean_commits":35.0,"dds":0.05142857142857138,"last_synced_commit":"6fb4f0ec32917600477b5ad999417c239be7afa7"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steevanb%2Fsymfony-form-options-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steevanb%2Fsymfony-form-options-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steevanb%2Fsymfony-form-options-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steevanb%2Fsymfony-form-options-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steevanb","download_url":"https://codeload.github.com/steevanb/symfony-form-options-builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243835942,"owners_count":20355611,"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":["formtype","php","symfony"],"created_at":"2024-10-12T19:05:43.861Z","updated_at":"2025-03-17T01:30:51.561Z","avatar_url":"https://github.com/steevanb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![version](https://img.shields.io/badge/version-5.0.0-green.svg)](https://github.com/steevanb/symfony-form-options-builder/tree/5.0.0)\n[![php](https://img.shields.io/badge/php-^7.1||^8.0-blue.svg)](https://php.net)\n[![symfony](https://img.shields.io/badge/symfony/form-^3||^4||^5||^6||^7-blue.svg)](https://symfony.com)\n![Lines](https://img.shields.io/badge/code%20lines-4918-green.svg)\n![Total Downloads](https://poser.pugx.org/steevanb/symfony-form-options-builder/downloads)\n[![Scrutinizer](https://scrutinizer-ci.com/g/steevanb/symfony-form-options-builder/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/steevanb/symfony-form-options-builder/)\n\nsymfony-form-options-builder\n============================\n\nIt helps you writing your Symfony FormType, with some traits and methods to add fields in buildForm() instead of\narray with some mysterious keys, and other stuff.\n\n[Installation](documentation/installation.md)\n\n[Changelog](changelog.md)\n\nObject-oriented FormType\n------------------------\n\nFormType::buildForm() object oriented instead of array\n\nExample:\n```php\nnamespace FooBundle\\Form\\Type;\n\nuse Steevanb\\SymfonyFormOptionsBuilder\\OptionsBuilder\\EmailOptionsBuilder;\nuse Steevanb\\SymfonyFormOptionsBuilder\\OptionsBuilder\\TextOptionsBuilder;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\n\nclass BarType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options)\n    {\n        # Since PHP 5.5, you can use FooClass::class\n        $builder-\u003eadd('field_text', TextType::class, TextOptionsBuilder::create()-\u003easArray());\n\n        # Since PHP 5.6, you can use the variadic syntax. asVariadic() parameter is field name.\n        $builder-\u003eadd(\n            ...EmailOptionsBuilder::create()\n                -\u003esetRequired(false)\n                -\u003esetPlaceHolder('default@mail.com')\n                -\u003esetTrim(false)\n                -\u003easVariadic('field_email')\n        );\n    }\n}\n```\n\n[More documentation](documentation/optionsbuilder.md)\n\nBlockPrefixTrait\n----------------\n\nAdd getBlockPrefix(), to always return same syntax for form type getBlockPrefix() method: form_type_formtypeclassname\n\nExample:\n```php\nnamespace FooBundle\\Form\\Type;\n\nuse Steevanb\\SymfonyFormOptionsBuilder\\BlockPrefixTrait;\n\nclass BarType extends AbstractType\n{\n    # Use this trait to define getBlockPrefix() required method. It will return form_type_bar\n    use BlockPrefixTrait;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteevanb%2Fsymfony-form-options-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteevanb%2Fsymfony-form-options-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteevanb%2Fsymfony-form-options-builder/lists"}