chrismccord

chrismccord

Creator of Phoenix

Phoenix 1.3.0 released

Hey folks,

Phoenix 1.3.0 is out! The final release please brings tweaks to web directory and alias conventions that were estabished in the first 1.3 RC, as well as a V2 channel wire-protocol.

If you are just tuning in for the first time on Phoenix 1.3 details, check out the rc.0 annoncement for background on the final release: Phoenix v1.3.0-rc.0 released

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Directory Changes

The “web” directory has been moved from lib/my_app/web, to lib/my_app_web. This change makes a clearer separation between your greater Elixir application and the web interface to it. The new convention also aligns more closely to the umbrella application structure, so it will be a more natural step to go from a single application to an umbrella application in the future. For example, the new structure produced by mix phx.new looks as follows:

lib
├── my_app
│   ├── application.ex
│   └── repo.ex
├── my_app.ex
└── my_app_web
|   ├── channels
|   ├── controllers
|   ├── endpoint.ex
|   ├── gettext.ex
|   ├── router.ex
|   ├── templates
|   ├── views
└── my_app_web.ex

Web alias changes

The MyApp.Web alias has been renamed to MyAppWeb. This removes a special-case naming convention we had that went against common Elixir conventions when it comes to naming umbrella applications. With this change, we now have parity with Elixir naming, with the added bonus that a unique namespace further signals the separation of your greater Elixir application and business logic from your Phoenix web tier.

New Channel V2 wire protocol

rc.3 also includes a backwards-compatible, V2 of our channel wire protocol. The new protocol resolves a race condition that was discovered under some messaging circumstances. The new format also includes improved data compaction when serializing. The updated phoenix.js client will use V2, but older clients unable to speak the new protocol will contiune to work as before.

Dynamic Endpoint config changes

The rc.0-2 on_init configuration is no longer supported. Instead of on_init, add the load_from_system_env: true to your endpoint config, then define an init/2 clause in your endpoint module. For example:

config :my_app, MyAppWeb.Endpoint,
  ...,
  load_from_system_env: true,

and then in your endpoint:

@doc """
  Callback invoked for dynamically configuring the endpoint.

  It receives the endpoint configuration and checks if
  configuration should be loaded from the system environment.
  """
  def init(_key, config) do
    if config[:load_from_system_env] do
      port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
      {:ok, Keyword.put(config, :http, [:inet6, port: port])}
    else
      {:ok, config}
    end
  end

Context Generator changes

The mix phx.gen.html|json|context generators no longer namespace tables by the context name, preferring to simply name the table after the given resource. After feedback from the previous RC’s, it was clear the prefix was a source of confusion and could be more difficult to maintain.

Context Guide and HexDocs powered Phoenix Guides

We are also nearing completion of our 1.3.0 guides overhaul, including the new context guide, which can be read here:

With the 1.3.0 release, we are moving off of readme.io for guide hosting and hosting all guides on hexdocs.pm. This allows us to share our ex_doc documentation for phoenix itself with the guides – enabling true cross-references between source docs and guides, as well as effortlessly versioned guides. Some formatting still needs to be addressed on the guides, but check them out on hexdocs and let us know what you think.

Thanks!

Chris

Most Liked

chrismccord

chrismccord

Creator of Phoenix

As promised, 1.3.0 has landed! Check out the officinal announcement here:

navinpeiris

navinpeiris

Awesome!!

In case it’s useful, you can see the changes to generated files between the two RC’s here: PhoenixDiff · v1.3.0-rc.2 to v1.3.0-rc.3

Or, if you’re upgrading from 1.2, you can see that at https://www.phoenixdiff.org as well.

chrismccord

chrismccord

Creator of Phoenix

If you have two database-backed schemas in different contexts that are entirely separate, but named the same, then you will need to give one of them a unique name. You can do this by passing the --table flag to the generator.

We would need to talk about your specific use case to say more, but please check out the new context guide which will give you ideas how to handle this kind of scenario. In the guide we create an authors table for author specific information for our CMS, rather than polluting our Account’s “users” table with author specific data.

Where Next?

Popular in Phoenix News Top

chrismccord
A minor vulnerability has been disclosed for applications redirecting to URLs provided by user input. Only applications passing user inpu...
New
chrismccord
The final release of Phoenix 1.7 is out! Most of the new features have been outlined in the 1.7 RC thread, but it has been a few months s...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
chrismccord
Phoenix 1.3.5, 1.4.18, 1.5.14, and 1.6.14 have been released to resolve a vulnerability in wildcard check_origin configurations. Previou...
New
chrismccord
Check the announcement blog for details! Blog duped here for convenience: Phoenix 1.8.0-rc released! The first release candidate of P...
418 13345 167
New
chrismccord
Announcement post dup’d here for convenience: Phoenix 1.7.2 is out! This minor release includes a couple features worth talking about. ...
New
josevalim
We were notified by Panagiotis Nezis that certain payloads could take a long time to process when converted to integers. New Erlang/OTP v...
New
chrismccord
Hey folks, Phoenix 1.3.0 is out! The final release please brings tweaks to web directory and alias conventions that were estabished in t...
New
chrismccord
I’m pleased to announce the first release candidate of Phoenix 1.6.0 has landed on the heels of a fresh LiveView 0.16 release! This relea...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement