Revision #41 has been created by rackycz on Sep 20, 2019, 12:27:55 PM with the memo:
edit
« previous (#40) next (#42) »
Changes
Title
unchanged
Yii v2 for beginners
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,beginner,yii2
Content
changed
[...]
-----
Skip this paragraph if you are in hurry :-) ... 8 years ago I started these two tutorials for Yii 1:
- [https://www.yiiframework.com/wiki/250/yii-for-beginners](https://www.yiiframework.com/wiki/250/yii-for-beginners)
- [https://www.yiiframework.com/wiki/462/yii-for-beginners-2](https://www.yiiframework.com/wiki/462/yii-for-beginners-2)
... and today I am beginning with Yii 2 so I will also gather my snippets and publish them here so we all can quickly setup the yii-basic-demo. just by copying and pasting.
I have
some4 years of experiences with Yii 1, but I havent used
Yii
t for almost 5 years so many things
i Yii 2 are new for me again. Plus I was suprised that the Yii 2 demo application does not contain some basic functionalities (like
DB login
via DB, translations etc) which must be implemented in the most of web projects so I will focus on them. Plus I will talk about GitLab.
If you find any problems in my snippets, let me know, please.
Prerequisities
---
Skip this paragraph if you know how to run your Yii demo project...[...]
- C:\xampp\htdocs\basic\config\db.php
... but it should work out -of
-the
-box if you use DB name "yii2basic" which is
usedalso used in examples below ...
Yii demo app + GitLab
---
... text ...
User management + basic SQL commandsOnce you download and run the basic app, I recommend to push it into [GitLab](https://gitlab.com/). You will probably need a SSH certificate which can be generated [like this](https://www.huber.xyz/?p=275) using [PuTTYgen](https://www.puttygen.com/). When I work with Git I use [TortoiseGIT](https://www.puttygen.com/) which integrated all git functionalities into the context menu in Windows File Explorer.
First go to GitLab web and [create a new project](https://gitlab.com/projects/new). Then you might need to fight a bit, because the login-process seems to be quite complicated.
Once things work, just create an empty folder, right click it and select Git Clone. Enter yout git path, best is this format:
- git@gitlab.com:{username}/{projectName}.git
When cloned, copy the content od the "basic" folder into thir git-folder and push everything except for folder "vendor" It contains 75MB and 7000 files. You dont want to have it in GIT.
Then you can start to mofify you project for example based on this tutorial (or better name would be a Snippet library)
User management + DB creation + login via DB
---
To create DB with users, use following command. I recommend charset **utf8_unicode_ci** (or utf8mb4_unicode_ci) as it allows you to use [more international characters](https://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci).[...]
```
Login via databasei18n translations + Session
---
... text ...
Access rights
---[...]