I think you need to learn a bit about how the Apache server works (assuming your using Apache). How to setup virtual hosts. What the hosts file is for… ect…
You don’t have to set any of those up, if your just wanting to mess around locally. If your asking the questions that you asked, I doubt your ready to make a full-fledged site for the public…
You don’t have to setup any virtual hosts or edit your host file. You just won’t have any nice domain alias for your site, it will be like: http://localhost/your-yii-app/web/index.php
If your using advanced: http://localhost/your-yii-app/frontend/web/index.php or http://localhost/your-yii-app/backend/web/index.php
You can set virtual hosts to make it nicer, like: http://client1-site.dev - We usually use the same domain as the real one, only use .dev instead of .com or .net, etc. Then your hosts file, you map the domain to yourself: 127.0.0.1 client1-site.dev
You can setup sub domains for advanced and have these paths, using virtual hosts and the host file:
http://mysite.dev
http://members.mysite.dev
http://admin.mysite.dev
However, none of it is required!
Just open Terminal (or command prompt) and navigate to your web directory…
Mac XAMPP: /Applications/XAMPP/xamppfiles/htdocs/
Windows WAMP: C:\wamp\www <-- i think?
Then run composer to download Yii as the docs say.
By default, it puts it into "yii2-basic" or "yii2-advanced". So you go to your web browse: http://localhost/yii2-basic/web
You can use it perfectly fine as localhost
The advanced app requires you to run init, so it can merge private files into the app. This is for shared projects, or swapping configs between your local server, testing server, production server.
You open Terminal (or command prompt) and navigate to your yii2 app. Then run init. If your on a mac, you have to put ‘./init’. The ./ tell it to execute as a script.
Fun fact. There is an app that will map "watever.dev" to a folder named "whatever" in your web root. Saving you from making all the vhost edits. I forget it, but will update this later with the name.