Yii 2 Api Project is the Fidelity REST API manager Yii 2 application project.
There are two components:
- the API that receives Rules Engine commands
- the webhook manager that manages the shopping cart events
The rules engine can trigger the api sending his payload to https://api.example.com/api/v1
The webhook can receive events from:
- WooCommerce
- ...
- ...
In the Fidelity dashboard the merchant have to set the Api keys for woocommerce plugin. Then, in WooCommerce add a new webhook and set these informations:
-
Topic: select
Order updated
-
Delivery URL: is a url containing:
- storeid: the store id
- pkey: the public api key
Then the url will be like this:
https://api.example.com/webhook/woocommerce?storeid=ZjdlTHl4N0Rxdkd0ZmlrUS81&pkey=g3WfwBQGpVzie4XnsY
-
Secret: the secret api key generated from Fidelity dashboard Api keys Manager
The minimum requirement by this project template that your Web server supports PHP 5.6.0.
docker login
docker run --rm -p 8000:80 jambtc/apifidelity-yii2
Clone the package from github
git clone https://github.com/jambtc/yii2-api.fidelity.git
Update your vendor packages
docker-compose run --rm php composer update --prefer-dist
Run the installation triggers (creating cookie validation code)
docker-compose run --rm php composer install
Start the container
docker-compose up -d
You can then access the application through the following URL:
http://127.0.0.1:8000
NOTES:
- You can use any ports you want by changing the value in the file
docker-compose.yml
- Minimum required Docker engine version
17.04
for development (see Performance tuning for volume mounts) - The default configuration uses a host-volume in your home directory
.docker-composer
for composer caches
Rename the file config/db.example.php
in db-docker.php
and edit with real data, for example:
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=database_name',
'username' => 'root',
'password' => 'mystrongpassword',
'charset' => 'utf8',
];
NOTES:
- Yii won't create the database for you, this has to be done manually before you can access it.
- Check and edit the other files in the
config/
directory to customize your application as required. - Refer to the README in the
tests
directory for information specific to basic application tests.