Phx.new vs phoenix.new

Hi, I’m new to Phoenix and I am making a new 1.3 project.

I run mix help and I see 2 commands to generate a new Phoenix project:

mix phoenix.new # Creates a new Phoenix v1.3.0 application
mix phx.new # Creates a new Phoenix v1.3.0 application

When I run phoenix.new it seems to create an older version, using phoenix-1.3.0-rc.

Is this something old and leftover? When I try to uninstall the phoenix archive it removes both, and adds them both back when I re-install it fresh.

Why is there an old command hanging around and what is it for?

Thanks

My guess it is left for now for compatibility and will be removed after the transition period

mix phoenix.new is old. It is still in your machine because it is installed locally and not distributed as part of Phoenix. Use mix archive.uninstall phoenix.new to remove it.

5 Likes

I tried that but it doesn’t appear to be listed?

~/Code » mix archive.uninstall phoenix.new
Could not find a local artifact named “phoenix.new”. We found:

  • hex-0.17.1
  • phx_new
    Archives installed at: /Users/zesty/.mix/archives

Part of the confusion, I think, is that the description for both phx.new and phoenix.new are the same. My understanding is that phoenix.new creates a 1.2 version and phx.new creates a 1.3 version. Is that correct? I also have both listed, and mix archive.uninstall doesn’t find the old phoenix.new. Also, “mix help” lists phoenix.new, but “mix archive” does not have it listed.

phx.new makes a 1.3 version (per the latest phoenix docs anyway.

I remember when I tested phoenix 1.3.0 RC but I have no idea where that’s stored locally. It’s not in the archives folder

Oh, I think we still include it on phx.new for backwards compatibility. In any case, it will be gone on v1.4!

2 Likes

Just FYI this version of phoenix.new installs version 1.3.0-rc

That’s what this original thread is about :laughing:

any update on this ?

What kind of update do you expect?

The thread is marked as “solved” in Phx.new vs phoenix.new

sorry.

Still, I’m getting:

mix archive.uninstall phoenix.new

**Could not find a local artifact named "phoenix.new". We found:**

* hex-0.18.1
* phoenix_new
* phx_new

so then ran :

mix archive.uninstall phoenix.new

and unfortunately still able to run mix phoenix.new

The package you need to uninstall is phoenix_new as it seems.

sorry, i should have written that i had run mix archive.uninstall phoenix_new , so now only getting

* hex-0.18.1
* phx_new

but mix phoenix.new ... remains available

Yes, as the phoenix 1.3 generators still ship with the old long form, that’s as intended to make transition easier. But now they should create a correctly versioned skeleton.

1 Like

The main difference is that of the directory structure. Using phoenix.new you’ll get a directory called web which will contain controllers, views, templates and models etc (this is not recommended), while using phx.new you’ll get controllers, views, templates and models etc under lib/yourapp_web and this is the recommended way to generate the project. Under the lib directory besides the yourapp_web directory you’ll also have yourapp directory which will contain the main logic of your application in form of different contexts.

Following is the tree structure of two applications created with the two commands,

1 Like

thx @DevotionGeo; this was my issue; as I’m getting in i got confused by the two; asked here to only be able to stick to the latest

@NobbZ so in other words, there is no way to get rid of this right ?

1 Like

Waiting for the release of phx_new that accompanies the phoenix 1.4 release is probably the only solution, thats when the longform shall be removed.

Until then, just do not use it.

1 Like

There’s one thing to understand with mix tasks. They can be local to a project brought in by dependencies and manually installed to be globally available.

phx.new and phoenix.new are the globally installed archives for creating a phoenix project. All other phx.* and phoenix.* tasks are not globally installed at all, but are local to a project if you have phoenix installed as dependency, which is the reason why you cannot remove them. They’re part of a dependency therefore there’re available.

Phoenix 1.4 will no longer ship with the old generators, which is why they’ll no longer be available as soon as one is using that version.

1 Like

You’re welcome! I’m glad to be helpful!

As @NobbZ said, the phoenix.new command will go away when Phoenix 1.4 is released.