{"id":18929436,"url":"https://github.com/thecodingmachine/html.renderer","last_synced_at":"2025-10-09T17:12:10.695Z","repository":{"id":57020124,"uuid":"11547451","full_name":"thecodingmachine/html.renderer","owner":"thecodingmachine","description":"This package contains the rendering mechanism of the Mouf framework. It is a mechanism allowing packages/templates/developers to overload a default template for various HTML objects.","archived":false,"fork":false,"pushed_at":"2022-12-01T16:36:56.000Z","size":120,"stargazers_count":0,"open_issues_count":2,"forks_count":4,"subscribers_count":12,"default_branch":"2.0","last_synced_at":"2025-10-09T17:12:08.989Z","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/thecodingmachine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-20T13:40:52.000Z","updated_at":"2022-12-01T16:36:39.000Z","dependencies_parsed_at":"2023-01-23T20:46:08.245Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/html.renderer","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/thecodingmachine/html.renderer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fhtml.renderer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fhtml.renderer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fhtml.renderer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fhtml.renderer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/html.renderer/tar.gz/refs/heads/2.0","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Fhtml.renderer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001887,"owners_count":26083197,"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-09T02:00:07.460Z","response_time":59,"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":"2024-11-08T11:32:43.366Z","updated_at":"2025-10-09T17:12:10.660Z","avatar_url":"https://github.com/thecodingmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/mouf/html.renderer/v/stable.svg)](https://packagist.org/packages/mouf/html.renderer)\n[![Total Downloads](https://poser.pugx.org/mouf/html.renderer/downloads.svg)](https://packagist.org/packages/mouf/html.renderer)\n[![Latest Unstable Version](https://poser.pugx.org/mouf/html.renderer/v/unstable)](https://packagist.org/packages/mouf/html.renderer)\n[![License](https://poser.pugx.org/mouf/html.renderer/license)](https://packagist.org/packages/mouf/html.renderer)\n[![Build Status](https://travis-ci.org/thecodingmachine/html.renderer.svg?branch=2.0)](https://travis-ci.org/thecodingmachine/html.renderer)\n[![Coverage Status](https://coveralls.io/repos/thecodingmachine/html.renderer/badge.svg?branch=2.0\u0026service=github)](https://coveralls.io/github/thecodingmachine/html.renderer?branch=2.0)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodingmachine/html.renderer/badges/quality-score.png?b=2.0)](https://scrutinizer-ci.com/g/thecodingmachine/html.renderer/?branch=2.0)\n\nWhat is this package?\n=====================\n\nThis package contains a rendering mechanism to **render objects in HTML**.\n\nFor application developers\n--------------------------\n\nYou are an application developer? [Learn how to use the rendering system](doc/for_application_developers.md) with PHP files or Twig templates\nto render your objects or overload renderers provided by packages.\n\nSee the video!\n\n\u003ciframe width=\"480\" height=\"360\" src=\"//www.youtube.com/embed/f2MyYSUic1U\" frameborder=\"0\" allowfullscreen\u003e\u003c/iframe\u003e\n\nFor package developers\n----------------------\n\nYou are a package developer? [Learn how to use the rendering system to allow other users to overload\nyour renderers easily.](doc/for_package_developers.md)\n\nInstallation\n------------\n\n```bash\n$ composer require mouf/html.renderer ^2\n```\n\nThe easiest way to use this package is through a dependency injection container compatible with [container-interop/service-providers](https://github.com/container-interop/service-provider).\n\nOnce installed, you need to register the [`Mouf\\Html\\Renderer\\RendererServiceProvider`](src/RendererServiceProvider.php) into your container.\n\nIf your container supports [thecodingmachine/discovery](https://github.com/thecodingmachine/discovery) integration, you have nothing to do. Otherwise, refer to your framework or container's documentation to learn how to register *service providers*.\n\n\n### Provided services\n\nThis *service provider* provides the following services:\n\n| Service name                | Description                          |\n|-----------------------------|--------------------------------------|\n| `RendererInterface::class`  | The default renderer. An alias to `ChainRenderer::class` |\n| `ChainRenderer::class`  | A composite renderer asking all other renderers in turn if they can render an object. |\n| `customRenderers`  | A list of `RendererInterface` objects at the \"custom\" level (top most level). This list is consumed by the `ChainRenderer` |\n| `customRenderer`  | A default custom renderer is provided by this package. Out of the box, template files are expected to be in the `src/templates` directory. |\n| `packageRenderers`  | A list of `RendererInterface` objects at the \"package\" level (bottom level). This list is consumed by the `ChainRenderer`. When a package you install has a renderer, it will add the renderer to this list (most of the time using the `AbstractPackageRendererServiceProvider` |\n| `InitRendererFacadeMiddleware::class`  | A PSR-15 middleware that is used to initialize global access to the default renderer. This is needed for the `Renderable` trait to work. |\n\n### Extended services\n\nThis *service provider* extends those services:\n\n| Name                        | Compulsory | Description                            |\n|-----------------------------|------------|----------------------------------------|\n| `MiddlewareListServiceProvider::MIDDLEWARES_QUEUE`              | *yes*      | The `InitRendererFacadeMiddleware::class` registers itself in the list of PSR-15 middlewares. |\n\n\nMouf package\n------------\n\nThis package was originally part of Mouf (http://mouf-php.com), an effort to ensure good developing practices by providing a graphical dependency injection framework.\n\nV2 makes the package framework-agnostic, so it can be used in any framework.\n\nBasically, you will find in this package some **Renderers**. These are classes in charge of rendering other objects.\nThey usually rely on *template files*, that contain the HTML to be rendered.\nRenderers can be *chained*, and the first renderer that knows how to render an object will be in charge of the rendering.\n\nTroubleshooting\n---------------\n\nYour template or a custom template is not applied.\n\n* Purge the cache with the red button in mouf.\n* You use Ajax and you return html with echo (for example BCE).\n\t* By default an echo don't apply the template to make it\n\t\t* add the defaultRenderer (a class of Mouf\\Html\\Renderer\\AutoChainRenderer) in your class\n\t\t* add your templateRenderer (a class of Mouf\\Html\\Renderer\\FileBasedRenderer) in Bootstrap this is bootstrapRenderer\n\t\t* add the code before your call to the function toHTML: $this-\u003edefaultRenderer-\u003esetTemplateRenderer($this-\u003etemplateRenderer);\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fhtml.renderer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Fhtml.renderer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Fhtml.renderer/lists"}