Changes
Title
unchanged
Yii3 - How to start
Category
unchanged
Tutorials
Yii version
unchanged
3.0
Tags
unchanged
Content
changed
(draft - all will be retested laterDon't forget to like and subscribe :-)
# Intro[...]
```
## Disclaimer
I am just learning Yii3. Its new architecture is not my cup of tea so I am trying my best to reach my goals. (I left world of Java+Spring because of these complex DI configurations and now it's back :-o )
If you find a better implementation, let me know. I am not an architect, but a real-life developer who solves daily problems in the world of bussines and industry so sometimes I may produce too straightforward or philosophically imperfect solutions.
## Adding DB into your project
Your project now does not contain any DB. Let's add MariaDB and Adminer (DB browser) into file docker/dev/compose.yml:[...]
Method `xdebug_info()` will still show `xdebug.mode=develop`, but `Step Debugger` will be `enabled`.
> You can e
hn
hance it by appending `idekey`, but IDE setup then may require you to specify
"IDE Key (session id)", the host (localhost:80) and set "path mapping" so that your local project-folder is mapped to "/app". All is done via IDE configuration.
>
```
>
> `XDEBUG_CONFIG="client_host=host.docker.internal start_with_request=yes idekey=yii3debug
`
```>
If you want to see correct value `xdebug.mode` in `xdebug_info()`, or generally configure xdebug via `xdebug.ini`, do this:
docker/dev/xdebug.ini:
```
xdebug.mode=develop,debug,coverage
xdebug.client_host=host.docker.internal[...]
docker/Dockerfile:
```
COPY docker/dev/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
```
dockerignore:
```
!/docker/dev/xdebug.ini
```[...]
You can do the same as above (chapter about xDebug) with `php.ini` for example to set the timezone:
```
[Date]
date.timezone = "UTC"[...]
docker/Dockerfile:
```
COPY docker/dev/php.ini /usr/local/etc/php/conf.d/custom.ini
```
##
UI
**Pjax
**
Pjax does not exist any more, but you can use [HTMX](https://htmx.org/docs/#introduction) instead:[...]
```
**## GridView + CRUD
Grid view is in package `yiisoft/yii-dataview`. The source code is extremely verbose and complex to me (compared to how primitive function it should provide), so I am just linking my GitHub demo:
- [Action](https://github.com/rackycz/yii3web/blob/master/src/User/Action/IndexAction.php)
- [method findAll()](https://github.com/rackycz/yii3web/blob/master/src/Entity/QueryBuilder/UserQueryBuilderRepository.php)
- [QueryDataReader](https://github.com/rackycz/yii3web/blob/master/src/Entity/QueryBuilder/QueryDataReader.php)
- [View](https://github.com/rackycz/yii3web/blob/master/src/User/View/index.php)
## JS client - Installable Vuejs3 PWA
**
If you create a REST API you may be interested in a JS frontend that will communicate with it using Ajax. Below you can peek into my very simple VueJS3 attempt. It is an installable PWA application that works in offline mode (=1 data transfer per day, not on every mouse click) and is meant for situations when customer does not have wifi everywhere. See my [Gitlab](https://gitlab.com/radin.cerny/vuejs3-pwa-demo-plus).