Skip to content

Instantly share code, notes, and snippets.

@tom--
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save tom--/f7a632e18d9114dc771a to your computer and use it in GitHub Desktop.

Select an option

Save tom--/f7a632e18d9114dc771a to your computer and use it in GitHub Desktop.

Yii 2 basic vs. advanced apps

The names of the two demo apps, Basic and Advanced, can be unhelpful. Many people end up choosing advanced just because of the name even though basic would suit them better.

The key differences are:

  1. Advanced has a complex system of configuration. It is designed so that a team of developers can work together on a project keeping everything, including app config, in VCS but each developer can customize their own config for development, testing and other environments.

    This configuration arrangement can be confusing and is often unnecessary. If you are working alone, you'd probably want to avoid it.

  2. Advanced has front-end and back-end web sites in the same project. This is a simple matter of organizing files into directories and configuring the web server. You can easily do the same thing in the basic app.

  3. Advanced has demo user management classes. This are a great way to learn generic user management (account creation, log-on, log-off). But this code is not production-ready—it is tutorial—so you still need to write your own. You can learn more by studying these classes and adapting the ideas to your own app, which can be based on the basic app.

Neither front/back-end separation nor user management is on its own is a good reason to choose advanced. It's better to adapt these features to your app—you'll learn more and won't get the difficult config baggage.

My advice

If you will be working on the project in a team and you might need the configuration flexibility of the advanced app then carefully read the Advanced Application Template page of The Definitive Guide to Yii 2.0. If that looks like what you need, try advanced.

If you need front/back-end separation, read the same page of the guide, study the code and use the ideas in your project.

If you need user management, study the advanced app to see how its User class is implemented. Also look at its SiteController and associated form models. Understand these and you can write your own user management, which for real work you'll have to do anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment