{"id":32234268,"url":"https://github.com/ruano-a/symfonycollectionjs","last_synced_at":"2025-10-22T12:48:07.921Z","repository":{"id":34920197,"uuid":"190637400","full_name":"ruano-a/symfonyCollectionJs","owner":"ruano-a","description":"A plugin working with and without jquery to dynamically create elements of a symfony form collection.","archived":false,"fork":false,"pushed_at":"2024-01-05T11:00:03.000Z","size":3078,"stargazers_count":17,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T02:58:37.216Z","etag":null,"topics":["collection","jquery-plugin","prototype","symfony"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ruano-a.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":"2019-06-06T19:23:25.000Z","updated_at":"2025-05-27T17:37:29.000Z","dependencies_parsed_at":"2024-12-30T11:50:56.474Z","dependency_job_id":"589106c2-5280-4f94-a7fd-21fd2a3af397","html_url":"https://github.com/ruano-a/symfonyCollectionJs","commit_stats":{"total_commits":86,"total_committers":3,"mean_commits":"28.666666666666668","dds":0.03488372093023251,"last_synced_commit":"6fdf53c94a771b5fd402fb088bc8e8bf0517c2f3"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/ruano-a/symfonyCollectionJs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruano-a%2FsymfonyCollectionJs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruano-a%2FsymfonyCollectionJs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruano-a%2FsymfonyCollectionJs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruano-a%2FsymfonyCollectionJs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruano-a","download_url":"https://codeload.github.com/ruano-a/symfonyCollectionJs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruano-a%2FsymfonyCollectionJs/sbom","scorecard":{"id":788436,"data":{"date":"2025-08-11","repo":{"name":"github.com/ruano-a/symfonyCollectionJs","commit":"4dc83dbf880dcf36671c34fc65ad5ee1ccf28f85"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codecov-tests.yml:1","Warn: no topLevel permission defined: .github/workflows/minification.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov-tests.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/ruano-a/symfonyCollectionJs/codecov-tests.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/minification.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/ruano-a/symfonyCollectionJs/minification.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/minification.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/ruano-a/symfonyCollectionJs/minification.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/minification.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/ruano-a/symfonyCollectionJs/minification.yml/master?enable=pin","Warn: downloadThenRun not pinned by hash: .github/workflows/codecov-tests.yml:14","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"28 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-866w-wm4h-95c6","Warn: Project is vulnerable to: GHSA-cfgr-75jx-h88g","Warn: Project is vulnerable to: GHSA-r737-347m-wqc7","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-q9mw-68c2-j6m5","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T06:45:28.066Z","repository_id":34920197,"created_at":"2025-08-23T06:45:28.066Z","updated_at":"2025-08-23T06:45:28.066Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280439990,"owners_count":26331171,"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","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["collection","jquery-plugin","prototype","symfony"],"created_at":"2025-10-22T12:48:05.652Z","updated_at":"2025-10-22T12:48:07.916Z","avatar_url":"https://github.com/ruano-a.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# symfonyCollectionJs ![GitHub](https://img.shields.io/github/license/ruano-a/symfonyCollectionJs) ![Maintenance](https://img.shields.io/maintenance/yes/2024) ![GitHub last commit](https://img.shields.io/github/last-commit/ruano-a/symfonyCollectionJs) ![npm](https://img.shields.io/npm/dm/symfony-collection-js?label=npm%20downloads) [![](https://data.jsdelivr.com/v1/package/npm/symfony-collection-js/badge)](https://www.jsdelivr.com/package/npm/symfony-collection-js) [![codecov](https://codecov.io/gh/ruano-a/symfonyCollectionJs/branch/master/graph/badge.svg?token=Z93Y3NTP1Q)](https://codecov.io/gh/ruano-a/symfonyCollectionJs) ![npm bundle size](https://img.shields.io/bundlephobia/min/symfony-collection-js) ![Dependencies](https://badgen.net/bundlephobia/dependency-count/symfony-collection-js) ![Badge count](https://img.shields.io/badge/badge%20count-enough%20%3C3-blue)\nA plugin working with and without jquery to dynamically create elements of a symfony form collection.\n\nI created this plugin because the common Js plugin had a bug that didn't let me place the button to add an element wherever I wanted.  And I wanted to be able to add dynamically elements.\n\n[Doc pages here](https://ruano-a.github.io/symfonyCollectionJs/)\n# Install with yarn\n```sh\nyarn add symfony-collection-js\n```\n\n# Or install with npm\n```sh\nnpm install symfony-collection-js\n```\n\n# Or include with a CDN\ncdnjs\n```html\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/symfonyCollectionJs/4.3.1/symfonyCollectionJs.min.js\" integrity=\"sha512-dUYlObeLuqKRYgg0Ujzm79lSc6dcOanSv+MtO2BM2svxSpSN+foESdbi82TZj7ixneAdj7pUoKMmNURVKz52jw==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"\u003e\u003c/script\u003e\n```\njsDelivr\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/symfony-collection-js@4.3.1/dist/symfonyCollectionJs.min.js\" integrity=\"sha256-96Lcx06vADOwwjV0CW7BlC92yedSb7898vE2ErDUj38=\" crossorigin=\"anonymous\"\u003e\u003c/script\u003e\n```\n\n# Basic usage (Check [here](#can-i-use-this-package-without-symfony) to use without symfony)\n\nYour collection container should have the prototype mentioned in the symfony documentation, and an id or a class. So in your form type:\n~~~~\n$builder-\u003eadd('collectionProperty',   CollectionType::class, [\n                ...\n                'prototype' =\u003e true,\n                'by_reference' =\u003e false,\n                'attr' =\u003e array(\n                    'class' =\u003e 'collection',\n                    ),\n                ...\n            ]);\n~~~~\n\nAnd to init the collection element in javascript:\n~~~~\n$('.collection').formCollection(); // with jQuery\nformCollection(document.querySelectorAll('.collection')); // in pure javascript with a selector\nformCollection(document.getElementById('myId')); // in pure javascript with an id\n~~~~\n\n# Options \n~~~~\nvar defaults =  {\n        max_elems:              100,\n        call_pre_add_on_init:   false,\n        call_post_add_on_init:  false,\n        pre_add:                function(context, index) { return true; },\n        post_add:               function(new_elem, context, index) { return true; },\n        pre_delete:             function(delete_elem, context, index) { return true; },\n        post_delete:            function(delete_elem, context, index) { return true; },\n        pre_up:                 function(elem, switched_elem, index) { return true; },\n        post_up:                function(elem, switched_elem, index) { return true; },\n        pre_down:               function(elem, switched_elem, index) { return true; },\n        post_down:              function(elem, switched_elem, index) { return true; },\n        other_btn_add:          null,\n        btn_add_selector:       '.collection-add',\n        btn_delete_selector:    '.collection-delete',\n        btn_up_selector:        '.collection-up',\n        btn_down_selector:      '.collection-down'\n        prototype_name:         '__name__'\n    };\n~~~~\nIn pre_up, post_up, pre_down and post_down, switched_elem is the moved elem that the user didn't click on.  \nprototype_name should probably be changed if you use nested collection (in the FormType too, with the same value).\n\nNote that the buttons are not created by the plugin but have to already exist.\n\n# Other functionalities\n\nAdd an empty element:\n~~~~\n$('.collection').formCollection('add'); // with jQuery\nformCollection(document.querySelectorAll('.collection'), 'add'); // in pure javascript with a selector\nformCollection(document.getElementById('myId'), 'add'); // in pure javascript with an id\n~~~~\n\nDelete an element with its index (starting from 0):\n~~~~\n$('.collection').formCollection('delete', 2); // with jQuery\nformCollection(document.querySelectorAll('.collection'), 'delete', 2); // in pure javascript with a selector\nformCollection(document.getElementById('myId'), 'delete', 2); // in pure javascript with an id\n~~~~\n\nClear every element (doesn't call pre_delete nor post_delete):\n~~~~\n$('.collection').formCollection('clear'); // with jQuery\nformCollection(document.querySelectorAll('.collection'), 'clear'); // in pure javascript with a selector\nformCollection(document.getElementById('myId'), 'clear'); // in pure javascript with an id\n~~~~\n\nRefresh the attributes of every elements from the index given (starting from 0). You might need this in specific cases, such as with drag and drop:\n~~~~\n$('.collection').formCollection('refreshAttributes', 0); // with jQuery\nformCollection(document.querySelectorAll('.collection'), 'refreshAttributes', 0); // in pure javascript with a selector\nformCollection(document.getElementById('myId'), 'refreshAttributes', 0); // in pure javascript with an id\n~~~~\n\nThe context argument in pre_add, post_add, pre_delete, and post_delete will have one of these values, depending on how it's called:\n~~~~\nformCollection.ADD_CONTEXT = {\n    BTN_ADD:        4,\n    OTHER_BTN_ADD:  8,\n    INIT:           15,\n    ADD_METHOD:     16\n};\nformCollection.DELETE_CONTEXT = {\n    BTN_DELETE:     23,\n    DELETE_METHOD:  42\n};\n~~~~\n\nIf pre_add, pre_delete, pre_up, pre_down return false, the operation (add, delete, up, down) isn't executed (for pre_add, the return doesn't affect the initialization of existing elements).\n\n# How to start the tests\n\n[Check this](./test/README.md)\n\n# Any advanced example?\n\nYes ! in the example folder, with and without jQuery, with and without loader.\n\n# Can I use this package without symfony?\n\nAbsolutely, you only need to have the data-prototype attribute properly set.\nWe provide you with [this example](./example/simple_collection_example_without_symfony.php) in php, but you can do this in every language, and most likely with most frameworks.\n\n# Is there a Symfony UX integration?\n\nYes! Just there : [UX Collection JS](https://github.com/tienvx/ux-collection-js)\n\n# Requirement\n\nSymfony 2 or more (For a normal usage, but you can use this without)\n\n# Notes\nIf you're using this without jQuery, but with a loader (AMD, CommonJS, or anything), you MUST use a version on a branch / tag with \"js-only\" in the name! Otherwise it WILL NOT BUILD! (I didn't want to make several versions but tests ended showing that it was the best choice... Unless you have a better idea?)\n\nThis should theoretically work with unlimited nested collection. However if you encounter an issue, let me know.  \nDon't hesitate to let me know if you're using this plugin, I'm super interested !  \nFor advances features, you should use the plugin of ninsuo.  \nThe file test/prep_nojquery_tests.js contains a homemade micro version of jQuery, I guess it can interest some people.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruano-a%2Fsymfonycollectionjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruano-a%2Fsymfonycollectionjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruano-a%2Fsymfonycollectionjs/lists"}