{"id":33990118,"url":"https://github.com/dansol/webpack-encore-view-helper","last_synced_at":"2026-03-17T22:11:13.621Z","repository":{"id":56962212,"uuid":"463939048","full_name":"dansol/webpack-encore-view-helper","owner":"dansol","description":"webpack-encore-view-helper is a laminas-view helper that help render all of the dynamic script and link tags needed when using Symfony Webpack Encore( a simpler way to integrate Webpack into your application - https://symfony.com/doc/current/frontend.html#webpack-encore).","archived":false,"fork":false,"pushed_at":"2024-06-30T10:44:57.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-15T01:53:26.818Z","etag":null,"topics":["encore","helper","laminas","mezzio","view","viewhelper","webpack"],"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/dansol.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}},"created_at":"2022-02-26T18:49:48.000Z","updated_at":"2024-03-17T18:05:20.000Z","dependencies_parsed_at":"2024-03-17T18:49:57.641Z","dependency_job_id":"5f56c5b5-ee82-49de-85ee-e4d31c058fe1","html_url":"https://github.com/dansol/webpack-encore-view-helper","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"e60fb79e5224abf82ed6e8dee0beabdca9b69356"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dansol/webpack-encore-view-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansol%2Fwebpack-encore-view-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansol%2Fwebpack-encore-view-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansol%2Fwebpack-encore-view-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansol%2Fwebpack-encore-view-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dansol","download_url":"https://codeload.github.com/dansol/webpack-encore-view-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dansol%2Fwebpack-encore-view-helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30633241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T17:32:55.572Z","status":"ssl_error","status_checked_at":"2026-03-17T17:32:38.732Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["encore","helper","laminas","mezzio","view","viewhelper","webpack"],"created_at":"2025-12-13T06:02:53.238Z","updated_at":"2026-03-17T22:11:13.612Z","avatar_url":"https://github.com/dansol.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-encore-view-helper\n\nwebpack-encore-view-helper is a laminas-view helper that help render all of the dynamic script and link tags needed \nwhen using Symfony Webpack Encore( a simpler way to integrate Webpack into your application - https://symfony.com/doc/current/frontend.html#webpack-encore).\n\n## Installation\n\nRun the following to install:\n\n```bash\n$ composer require dansol/webpack-encore-view-helper\n```\n\n## Documentation\nCopy webpack_encore_view_helper_config.global.php.dist to config/autoload and rename webpack_encore_view_helper_config.global.php\u003cbr\u003e\nAdjust configuration based on your enviroment.\u003cbr\u003e\nexample:\n\n```php\n\u003c?php\nreturn [\n\t...\n    'webpack_encore_view_helper_config'=\u003e[\n\t\t/* webpack encore entry points */\n        'entrypoints_map' =\u003e json_decode(file_get_contents(__DIR__ . '/../../public/build/entrypoints.json'),true),\n\t\t/* map view to entrypoint ( array can be empty if templates name match entrypoint name when using auto* parameters */\n        'template_entrypoint_map'=\u003e[\n\t\t\t\n\t\t\t'layout::default'=\u003e'app',\n        ]\n    ]\n];\n```\n\nLoad ConfigProvider in your configuration loader.\u003cbr\u003e\nMezzio example:\n\n```php\n\u003c?php\n$aggregator = new ConfigAggregator([\n\t// ... other stuff \n    \\WebpackEncoreViewHelper\\ConfigProvider::class,\n    // Default App module config\n      new PhpFileProvider(realpath(__DIR__) . '/autoload/{{,*.}global,{,*.}local}.php'),\n    // Load development config if it exists\n    new PhpFileProvider(realpath(__DIR__) . '/development.config.php'),\n], $cacheConfig['config_cache_path']);\n?\u003e\n```\n### Basic usage\n\n```php\n...\n// load asset ( in layout template)\n$this-\u003ewebpack_encore_assets('common entrypointname'); // if used a common entry\n\n// load asset ( in template that consume an entrypoint)\n$this-\u003ewebpack_encore_assets('common entrypointname'); // if used a common entry\n\n// in layout template\n// render link tags\necho $this-\u003ewebpack_encore_assets()-\u003erender('css');\n...\n// render script tags\necho $this-\u003ewebpack_encore_assets()-\u003erender('js');\n```\n\n### Special parameters\nthese parameters can be used in parent template(layout template) - if used in child template an error will be raise:\n* auto\t\t\t-  load all assets automatically( parent and first child template in content)\n* auto-route\t-  load all assets for parent template(layout)\n* auto-child\t-  load all assets for child template(firt template in layout content)\nthis parameters avoid the need to load asset in every template that consume an entry point and load asset only in the main layout template\n\nauto* parameters load entry with this logic:\nasset is loaded matching templatename/entrypoint name configured in webpack_encore_view_helper_config.global.php configuration file in \ntemplate_entrypoint_map key ( see webpack_encore_view_helper_config.global.php.dist)\nif not matched the helper will try to match template name equal to entrypoint name.\nIf entrypoint is not resolved an error will be raise.\n\n\nbasic example:\n\n```php\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"utf-8\" /\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\" /\u003e\n    \u003clink rel=\"shortcut icon\" href=\"https://getlaminas.org/images/favicon/favicon.ico\" /\u003e\n    \u003c?=$this-\u003eheadTitle('mezzio')-\u003esetSeparator(' - ')-\u003esetAutoEscape(false)?\u003e\n    \u003c?=$this-\u003eheadMeta()?\u003e\n    \u003c?php \n\t\t// load all asset for \n\t\t$this-\u003ewebpack_encore_assets('auto');\n\t?\u003e\n    \u003c?php\n\t\t// render links tags for this template(shared entry) and every asset required for the first child template in content\n\t\techo $this-\u003ewebpack_encore_assets()-\u003erender('css')\n\t?\u003e \n\u003c/head\u003e\n\u003cbody class=\"app\"\u003e\n\t...\n    \u003cdiv class=\"app-content\"\u003e\n        \u003cmain class=\"container\"\u003e\n            \u003c?=$this-\u003econtent?\u003e \n        \u003c/main\u003e\n    \u003c/div\u003e\n    \u003cfooter class=\"app-footer\"\u003e\n        ...\n    \u003c/footer\u003e\n    \u003c?php\n\t\t// render scripts tags for this template(shared entry) and every asset required for the first child template in content\n\t\techo $this-\u003ewebpack_encore_assets()-\u003erender('js')\n\t?\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdansol%2Fwebpack-encore-view-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdansol%2Fwebpack-encore-view-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdansol%2Fwebpack-encore-view-helper/lists"}