{"id":21657256,"url":"https://github.com/cantido/liberator_phoenix","last_synced_at":"2025-03-20T05:18:59.145Z","repository":{"id":57516190,"uuid":"403821859","full_name":"Cantido/liberator_phoenix","owner":"Cantido","description":"Phoenix integration for Liberator","archived":false,"fork":false,"pushed_at":"2021-10-03T05:54:25.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-25T09:42:35.588Z","etag":null,"topics":["elixir","hacktoberfest","liberator","phoenix"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/liberator_phoenix/","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cantido.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSES/CC0-1.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-07T02:58:08.000Z","updated_at":"2021-10-03T17:53:48.000Z","dependencies_parsed_at":"2022-08-28T16:50:26.282Z","dependency_job_id":null,"html_url":"https://github.com/Cantido/liberator_phoenix","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cantido%2Fliberator_phoenix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cantido%2Fliberator_phoenix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cantido%2Fliberator_phoenix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cantido%2Fliberator_phoenix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cantido","download_url":"https://codeload.github.com/Cantido/liberator_phoenix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554120,"owners_count":20471173,"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":["elixir","hacktoberfest","liberator","phoenix"],"created_at":"2024-11-25T09:20:13.656Z","updated_at":"2025-03-20T05:18:59.129Z","avatar_url":"https://github.com/Cantido.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nSPDX-FileCopyrightText: 2021 Rosa Richter\n\nSPDX-License-Identifier: MIT\n--\u003e\n\n# Liberator.Phoenix\n\n[![Hex.pm](https://img.shields.io/hexpm/v/liberator_phoenix)](https://hex.pm/packages/liberator_phoenix/)\n[![builds.sr.ht status](https://builds.sr.ht/~cosmicrose/liberator_phoenix.svg)](https://builds.sr.ht/~cosmicrose/liberator_phoenix?)\n\n[Phoenix] integration for the [Liberator] library.\n\nWith this plugin, you can use Phoenix views to render the result of Liberator handlers.\n\n[Phoenix]: https://github.com/phoenixframework/phoenix\n[Liberator]: https://sr.ht/~cosmicrose/liberator\n\n## Installation\n\nThis package is available in hex.\nYou can install it by adding `liberator_phoenix` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:liberator_phoenix, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nDocs can be found at [https://hexdocs.pm/liberator_phoenix](https://hexdocs.pm/liberator_phoenix).\n\n## Usage\n\nThis module implements Liberator handlers that render Phoenix views.\nIt infers your view name by replacing `Resource` in your module name with `View`.\nFor example, `MyPhoenixResource` will use `MyPhoenixView` as its view module.\n\n```elixir\ndefmodule MyPhoenixResource do\n  use Liberator.Resource\n  use Liberator.Phoenix\nend\n\ndefmodule MyPhoenixView do\n  use MyProject, :view\nend\n```\n\nIf you need to override it, set the `:view_module` option in your `use` statement.\n\n```elixir\ndefmodule MyPhoenixResource do\n  use Liberator.Resource\n  use Liberator.Phoenix, view_module: MyOtherView\nend\n```\n\nYou can also select only certain handlers to be overridden with the `:only` and `:except` options.\n\n```elixir\ndefmodule MyPhoenixResource do\n  use Liberator.Resource\n  use Liberator.Phoenix, only: [:handle_ok]\nend\n```\n\nThe handlers will use the status code as the template name and the extension of the negotiated media type.\nFor example, the `handle_not_found` handler with a negotiated media type of `text/plain` will render `404.txt`.\nThe `handle_created` handler with a media type of `application/json` will render `201.json`.\n\nThe values set in `conn.assigns` will be given to the view as well.\n\n## License\n\nMIT License\n\nCopyright 2020 Rosa Richter\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcantido%2Fliberator_phoenix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcantido%2Fliberator_phoenix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcantido%2Fliberator_phoenix/lists"}