What is Elixir Phoenix?

Review of Elixir's Phoenix framework with overvies of it's structure and main features
24 July 2017   1388
Elixir

Elixir is a dynamic, functional language designed for building scalable and maintainable applications

A framework is a logical ordering of code that implements a certain idea, as well as a set of tools for easy development of software products. But the main role for the framework, including what it can allow for the developer, is the programming language on which it is written.

The Phoenix Framework is written in elixir. In essence, its language is a "syntactic sugar" for another well-known programming language - erlang. But the most important thing about it is that it's written in the rubyst (Jose Valim) and it is very similar to Ruby on Rails. But some similarities can be found only in the syntax. Everything else - data structures, control blocks is different. The main thing to remember about Elixir is a functional programming language.

Framework structure

Phoenix is ​​an MVC framework. Structuring is very Rails look-alike:

  • Web/controllers - here are the controllers;
  • Web/models - here are the models;
  • Web/views - here are the views.

But if you go to the Web/views, you will not find a single template there. Here begins an interesting feature of phoenix.

Elixir syntax
Elixir syntax

Templates are located in another place - Web/templates. It turns out that views are not what we are used to seeing in the Rails. The Phoenix Framework views perform the following functions (at least what I was able to figure out at the moment):

  • Rendering templates.
  • Additional functions that can be used in templates.

Access to data

There are several options for where to store the data:

  • DB mnesia, which is written in erlang and is native to elixir as well;
  • Ecto, analogue of Active Record. At the moment, there are adapters for postgresql and mysql. ActiveRecord this library, of course, a little like, but it immediately goes out of the box and is, by itself, a standard solution.

Ecto supports almost all the necessary functionality to work with this data, which we are accustomed to using in the rails:

  • Creating a database using a special mix of the task;
  • Creating models;
  • Generation of migrations;
  • Associations;
  • Validation;
  • CRUD operations, etc.

Assets

By default, the compilation of the asserts is done using the node.js from brunch package. So, you will have to install node.js

Development

Another bunch of similar Rails-style features:

  • Batch manager;
  • A large number of libraries, plug-ins;
  • There is an analogue of the rake of the tusks - mix;
  • Generate an application using a mix;
  • Different scaffold generators;
  • There is an analog Gemfile'a - mix.exs.

In general, everything is quite similar to Rails. Commands are only named differently, but semantically they perform the same actions.

Conclusion

Given all the factors, and also that product is still active development, Phoenix Framework will be an excellent alternative to Ruby on Rails. We will be happy to observe the development! 

Elixir v1.7.0-rc.0 Released

Development team ask community to try out new release 
17 July 2018   94

Elixir team rolled out zero release candidate for version 1.7.0.

Hi everyone,

We have just released v1.7.0-rc.0.

Please give it a try! You can either compile the v1.7 branch from source OR use the precompiled files, as described in our install page 11.

Note that you will need {:ex_doc, "~> 0.19-rc"}if you want to generate docs using the release candidate.

Happy coding!
 

josevalim

Creator, Elixir

Currently Elixir supports two metadata keys: :deprecated and :since. Other keys will be added in the future. 

To access the new documentation, developers should use Code.fetch_docs/1. The old documentation format is no longer available and the old Code.get_docs/1 function will return nil accordingly.

Tools like IEx and ExDoc have been updated to leverage the new format and show relevant metadata to users

Learn more at GitHub