{"id":16656045,"url":"https://github.com/mcrumm/phoenix_profiler","last_synced_at":"2025-04-05T06:08:27.595Z","repository":{"id":37679106,"uuid":"412243848","full_name":"mcrumm/phoenix_profiler","owner":"mcrumm","description":"Web Profiler and Debug Toolbar for Phoenix Framework","archived":false,"fork":false,"pushed_at":"2023-07-12T23:11:49.000Z","size":504,"stargazers_count":190,"open_issues_count":7,"forks_count":5,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-04-14T05:51:49.551Z","etag":null,"topics":["dashboard","debug","elixir","phoenix","phoenix-framework","telemetry","toolbar"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/mcrumm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["mcrumm"]}},"created_at":"2021-09-30T22:13:15.000Z","updated_at":"2024-04-07T09:29:04.000Z","dependencies_parsed_at":"2024-10-12T10:06:14.418Z","dependency_job_id":null,"html_url":"https://github.com/mcrumm/phoenix_profiler","commit_stats":{"total_commits":215,"total_committers":4,"mean_commits":53.75,"dds":"0.38139534883720927","last_synced_commit":"ab3090d3d548c932dc667407deaa9afc9f183ffb"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Fphoenix_profiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Fphoenix_profiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Fphoenix_profiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcrumm%2Fphoenix_profiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcrumm","download_url":"https://codeload.github.com/mcrumm/phoenix_profiler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294539,"owners_count":20915340,"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":["dashboard","debug","elixir","phoenix","phoenix-framework","telemetry","toolbar"],"created_at":"2024-10-12T09:56:06.585Z","updated_at":"2025-04-05T06:08:27.574Z","avatar_url":"https://github.com/mcrumm.png","language":"Elixir","funding_links":["https://github.com/sponsors/mcrumm"],"categories":[],"sub_categories":[],"readme":"# PhoenixProfiler\n\n\u003c!-- MDOC --\u003e\nProvides a **development tool** that gives detailed information about the execution of any request.\n\n**Never** enable it on production servers as it exposes sensitive data about your web application.\n\n## Built-in Features\n\n* Request/Response - status code, params, headers, cookies, etc.\n\n* Routing - endpoint, router, controller/live view, action, etc.\n\n* Basic diagnostics - response time, memory\n\n* Inspect LiveView crashes\n\n* Inspect Ecto queries (Coming Soon)\n\n* Swoosh mailer integration (Coming Soon)\n\n## Installation\n\nTo start using the profiler, you will need the following steps:\n\n1. Add the `phoenix_profiler` dependency\n2. Enable the profiler on your Endpoint\n3. Configure LiveView\n4. Add the `PhoenixProfiler` plug\n5. Mount the profiler on your LiveViews\n6. Add the profiler page on your LiveDashboard (optional)\n\n### 1. Add the phoenix_profiler dependency\n\nAdd phoenix_profiler to your `mix.exs`:\n\n```elixir\n{:phoenix_profiler, \"~\u003e 0.2.0\"}\n```\n\n### 2. Enable the profiler on your Endpoint\n\nPhoenixProfiler is disabled by default. In order to enable it,\nyou must update your endpoint's `:dev` configuration to include the\n`:phoenix_profiler` option:\n\n```elixir\n# config/dev.exs\nconfig :my_app, MyAppWeb.Endpoint,\n  phoenix_profiler: []\n```\n\nAll web configuration is done inside the `:phoenix_profiler` key on the endpoint.\n\nThe following options are available:\n\n* `:enable` - When set to `false`, disables profiling by default. You can\n  always enable profiling on a request via `enable/1`. Defaults to `true`.\n\n* `:profiler_link_base` - The base path for generating links\n  on the toolbar. Defaults to `\"/dashboard/_profiler\"`.\n\n* `:toolbar_attrs` - HTML attributes to be given to the element\n  injected for the toolbar. Expects a keyword list of atom keys and\n  string values. Defaults to `[]`.\n\n### 4. Configure LiveView\n\n\u003e If LiveView is already installed in your app, you may skip this section.\n\nThe Phoenix Web Debug Toolbar is built on top of LiveView. If you plan to use LiveView in your application in the future we recommend you follow [the official installation instructions](https://hexdocs.pm/phoenix_live_view/installation.html).\nThis guide only covers the minimum steps necessary for the toolbar itself to run.\n\nUpdate your endpoint's configuration to include a signing salt. You can generate a signing salt by running `mix phx.gen.secret 32` (note Phoenix v1.5+ apps already have this configuration):\n\n```elixir\n# config/config.exs\nconfig :my_app, MyAppWeb.Endpoint,\n  live_view: [signing_salt: \"SECRET_SALT\"]\n```\n\n### 5. Add the PhoenixProfiler plug\n\nAdd the `PhoenixProfiler` plug within the `code_reloading?`\nblock on your Endpoint (usually in `lib/my_app_web/endpoint.ex`):\n\n```elixir\n  if code_reloading? do\n    # plugs...\n    plug PhoenixProfiler\n  end\n```\n\n### 6. Mount the profiler on your LiveViews\n\nNote this section is required only if you are using LiveView, otherwise you may skip it.\n\nAdd the profiler hook to the `live_view` function on your\nweb module (usually in `lib/my_app_web.ex`):\n\n```elixir\n  def live_view do\n    quote do\n      # use...\n\n      on_mount PhoenixProfiler\n\n      # view helpers...\n    end\n  end\n```\n\nThis is all. Run `mix phx.server` and observe the toolbar on your browser requests.\n\n### 7. Add the profiler page on your LiveDashboard (optional)\n\nNote this section is required for the LiveDashboard integration. If you are\nnot using LiveDashboard, you may technically skip this step, although it is\nhighly recommended that you\n[install LiveDashboard](https://hexdocs.pm/phoenix_live_dashboard/Phoenix.LiveDashboard.html#module-installation)\nto enjoy all the features of PhoenixProfiler.\n\nAdd the dashboard definition to the list of `:additional_pages` on\nthe [`live_dashboard`](`Phoenix.LiveDashboard.Router.live_dashboard/2`) macro\nin your router (usually in `lib/my_app_web/router.ex`):\n\n```elixir\nlive_dashboard \"/dashboard\",\n  additional_pages: [\n    _profiler: {PhoenixProfiler.Dashboard, []}\n    # additional pages...\n  ]\n```\n\n## Troubleshooting\n\n### Exception raised with other on_mount hooks\n\nIf after enabling the profiler, you see an error like the\nfollowing:\n\n```elixir\n** (exit) an exception was raised:\n** (RuntimeError) cannot attach hook with id :active_tab on :handle_params because the view was not mounted at the router with the live/3 macro\n```\n\nThen you need to add an extra clause on your `on_mount/4` function:\n\n```elixir\ndef on_mount(_arg, :not_mounted_at_router, _session, socket) do\n  {:cont, socket}\nend\n```\n\nThis is true for any handle_params hooks that will be invoked\nfor LiveView modules not mounted at the router (i.e. via\nlive_render/3), and the web debug toolbar is no exception.\n\n\u003c!-- MDOC --\u003e\n\n## Contributing\n\nFor those planning to contribute to this project, you can run a dev app with the following commands:\n\n    $ mix setup\n    $ mix dev\n\nAlternatively, run `iex -S mix dev` if you also want a shell.\n\n## License\n\nMIT License. Copyright (c) 2021 Michael Allen Crumm Jr.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcrumm%2Fphoenix_profiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcrumm%2Fphoenix_profiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcrumm%2Fphoenix_profiler/lists"}