mix phx.gen (Phoenix v1.8.1)

View Source

Lists all available Phoenix generators.

The table below shows a summary of the contents created by the CRUD generators:

TaskSchemaMigrationContextControllerViewLiveView
phx.gen.embeddedx
phx.gen.schemaxx
phx.gen.contextxxx
phx.gen.livexxxx
phx.gen.jsonxxxxx
phx.gen.htmlxxxxx

Customizing generators

You can override the default templates used by generators.

For example, to customize phx.gen.live, you can copy and edit the generator templates to your own project's priv folder:

First, create the directory for your custom phx.gen.live templates:

$ mkdir -p priv/templates/phx.gen.live

Next, copy the default phx.gen.live generator templates into your project so you can customize them:

$ cp -r deps/phoenix/priv/templates/phx.gen.live/* priv/templates/phx.gen.live/

Phoenix generators will look for templates in your project's priv/templates directory first. If a matching template is found, it will be used instead of the default.

Note generator templates may change between minor or even patch Phoenix releases, so custom templates may require updates after upgrading. Use this mechanism at your own risk.

Summary

Functions

Callback implementation for Mix.Task.run/1.

Functions

run(args)

Callback implementation for Mix.Task.run/1.