Please follow this link if you want something similar to this project: https://github.com/hunwalk/yii2-app-forge
This is a somewhat modified version of the basic template with some pregonfigured features. I've created this to save time upon creating a new project.
Please leave a star if you're considering to use this template in production.
Contains:
A conventional commits helper
https://github.com/damianopetrungaro/php-commitizen / A tool for conventional commits
Use the latest release
$ composer create-project hunwalk/yii2-basic-firestarter <projectName> --prefer-dist
Or use the current master branch, if you're in a hurry for features if there is any
$ git clone https://github.com/HunWalk/yii2-basic-firestarter <projectName>
$ cd <projectName>
$ composer install
$ composer run-script post-create-project-cmd
post-create-project-cmd script sets up the permissions for some folders and generates the cookieValidationKey for you
Create a .env file from the .env.example
OSX / LINUX
$ cp .env.example .env
Windows
$ copy .env.example .env
Fill in the .env file. Add or remove things, it's your choice entirely
Run the following commands
$ php yii migrate-user
$ php yii migrate-rbac
$ php yii migrate
Run the server and be happy :)
$ php yii serve
You can reach the api at api/v1
There is an example controller you can test.
That is purely for demonstration, and can be better.
Read this carefully, if you've never done something like this.
api/v1/user/settings/profile
Authorization
Authorization
header value should be your token.If you did everything right, you should get back the updated profile.
The token looks like this:
1:1574952622:d1da75dd83fc643384c728ed7ecfb266574d6533
It has 3 parts. The user_id, the current timestamp, and the users api_key sha1 hashed together with the current timestamp.
You can find more information about generating that token inside the v1 modules DefaultController Also, you should delete that before going to production.
You can obtain the users api_key from the user table in the api_key column.
Thanks to the conventional commits project and this guy: https://github.com/damianopetrungaro/
It seems like, something broke after i released this update, and the fire/commit command does not really work. Requires some tweaking, but definitely going to fix this sometime. However feel free to use the idea of the conventional commits. It's really great :smile:
Send a PR if you have one :)
Comments