{"id":33983866,"url":"https://github.com/fccn/wt-web-components","last_synced_at":"2026-06-08T14:31:29.850Z","repository":{"id":62503750,"uuid":"181038107","full_name":"fccn/wt-web-components","owner":"fccn","description":"A collection of web components to integrate in web applications","archived":false,"fork":false,"pushed_at":"2019-04-12T15:49:02.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-14T16:44:03.947Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fccn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-12T15:45:32.000Z","updated_at":"2019-04-12T15:47:44.000Z","dependencies_parsed_at":"2022-11-02T12:30:59.837Z","dependency_job_id":null,"html_url":"https://github.com/fccn/wt-web-components","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fccn/wt-web-components","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fccn%2Fwt-web-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fccn%2Fwt-web-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fccn%2Fwt-web-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fccn%2Fwt-web-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fccn","download_url":"https://codeload.github.com/fccn/wt-web-components/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fccn%2Fwt-web-components/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34067347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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":[],"created_at":"2025-12-13T04:12:01.657Z","updated_at":"2026-06-08T14:31:29.829Z","avatar_url":"https://github.com/fccn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webapp tools - web components\n\nThis presents a collection of web components to integrate with the [FCCN's webapp skeleton](https://github.com/fccn/webapp-skeleton.git) project. The following components are provided:\n\n- External libraries loader - loads external javascript libraries installed by composer and npm.\n- Language Switcher Action - Controller action for switching the site language\n\n## Installation\n\nYou can install this collection in your project using composer:\n```\ncomposer require fccn/webapp-tools-web-components\n\n```\n\n## Configuration\n\nThe site configuration loader from the [Webapp Tools - common](https://github.com/fccn/wt-common) project is used to centralize the configuration of each of component. You need to add a specific set of key-value pairs to the site configuration file, as described in the sections below.\n\nSome of the web components provide twig views to render HTML content. All the twig template files are located in the **templates** folder. To load them in your project you need to register a twig namespace for this directory. When integrating with the [FCCN's webapp skeleton project](https://github.com/fccn/webapp-skeleton.git) you need to add the following line to the *templates_path* variable in the site configuration:\n```\n$templates_path =  array(\n  ...\n  'web_components' =\u003e $fs_root.'/vendor/fccn/webapp-tools/web-components/templates' #add this line\n  ...\n  );\n```\n\n### External libraries loader\n\nFor cleaner paths it is advised to create variables for the node modules and vendor folders in the configuration file:\n```php\n $node_mods_path = $fs_root.'/node_modules/';\n $vendor_path = $fs_root.'/vendor/';\n\n```\nYou can than add the following key-value pairs to the config file's *$c* array:\n\n```php\n//---- External libraries loader --------------------\n\"ext_libs_loader_service_name\" =\u003e 'loader',  #name of the loader service in Slim container\n\"ext_libs\" =\u003e array(\n  //add libraries with the format name =\u003e path like for example:\n  \"headjs\" =\u003e $node_mods_path.\"/headjs/dist/1.0.0/head.min.js\",\n\n  );\n```\n\nThe example below shows how to create a new Slim service for the external library loader\n\n```php\n\n$app = new Slim\\App();\n$c = $app-\u003econtainer();\n\n//setup ext libs loader\n$cnt_name = \\Fccn\\Lib\\SiteConfig::getInstance()-\u003eget('ext_libs_loader_service_name');\n$c[$cnt_name] = function($cnt){\n  $loader = \\Fccn\\WebComponents\\ExtLibsLoader::getInstance();\n  return $loader;\n}\n```\n\nYou can associate a URL path for loading external libraries using the provided controller action - LoadExternalJSAction. The example below shows how to set the *\u003csite-url\u003e/script/lib/{libname}* path to the action controller:\n\n```php\n\n$app = new Slim\\App();\n\n#set route for load library action\n$app-\u003eget('/script/lib/{libname}', Fccn\\WebComponents\\LoadExternalJsAction::class);\n\n```\n\n## Usage\n\n### External libraries loader\n\nTo load the external library just point to the URL you have configured in the Slim routes with the name of the library.\n\n## Testing\n\nThis project uses codeception for testing. To run the tests call ``composer test`` on the root of the project folder.\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/fccn/wt-translate/tags).\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffccn%2Fwt-web-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffccn%2Fwt-web-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffccn%2Fwt-web-components/lists"}