Skip to content

Commit

Permalink
update php-demo documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
steverucker committed Nov 29, 2017
1 parent a6d891c commit 06b62cc
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 261 deletions.
82 changes: 48 additions & 34 deletions php-demo/README.md
Expand Up @@ -26,56 +26,70 @@ Using the Kairos Face Recognition API, the Verify Demo compares two photos, and
[Documentation](/php-demo/verify/README.md)


## Environment Setup and Installation
## Installation

The demo app can easily be run using Docker with the included Dockerfile and docker-compose.yml.
The demo app can easily be run either locally or using Docker with the included Dockerfile and docker-compose.yml.

The app is basically a single page application, which is viewed at index.php.

Sign-up for your API key via [developer.kairos.com](https://developer.kairos.com) and check your inbox for an activation link. You should now have your `APP_ID` and `APP_KEY`

#### Steps:

1. clone or fork the repo, and git clone via command-line (CLI):
#### Clone or fork the repo, and git clone via command-line (CLI):
```
cd $HOME/Desktop
git clone https://github.com/kairosinc/api-examples.git
```
2. Edit the `docker-compose.yml` file in the root project directory to add your `APP_ID` and `API_KEY` in the following lines, and save the file:
```
Enter your personal keys into the docker-compose.yml file:
version: '2'
services:
demo:
image: demo
expose:
- "8080"
ports:
- "8080:80"
environment:
STAGE: dev
AWS_S3_REGION: "us-east-1"
AWS_S3_UPLOAD_BUCKET: "valid-s3-bucket-here"
APP_ID: "your-app-id-here"
APP_KEY: "your-app-key-here"
API_URL: "https://api.kairos.com"
API_TIMEOUT: "10"
POLL_TIMEOUT: "300"
DEMO1_ID: "x"
DEMO_SECRET_KEY: "abc123"
XDEBUG: "true"
XDEBUG_CONFIG: "remote_host=10.254.254.254"
volumes:
- .:/var/www/app/php-demo
#### Running the app on your local system

* The application can be run from a server, such as MAMP, WAMP, LAMP OR XAMPP, or another type of virtual machine or solution stack.
* Insert your Kairos API ID and Key into the config.php file, which is at the root of the demo directory.
* The demo should render at the the host that you designated in your stack or virtual machine: {host}/demo/emotion/
* NOTE: The webcam functionality requires that your app has SSL enabled. To do this, you can create a self-signed certificate and key and add these to your config settings. MAMP Pro will create the certificate files and then add them to your config automatically. If you're using Apache, the standard SSL port will be 443, so your demo will render here: https://{host}/demo/emotion/

#### Running the app in a Docker container
* Enter your personal keys into the docker-compose.yml file:
```
version: '2'
services:
demo:
image: demo
expose:
- "8080"
ports:
- "8080:80"
environment:
STAGE: dev
AWS_S3_REGION: "us-east-1"
AWS_S3_UPLOAD_BUCKET: "valid-s3-bucket-here"
APP_ID: "your-app-id-here"
APP_KEY: "your-app-key-here"
API_URL: "https://api.kairos.com"
API_TIMEOUT: "10"
POLL_TIMEOUT: "300"
DEMO1_ID: "x"
DEMO_SECRET_KEY: "abc123"
XDEBUG: "true"
XDEBUG_CONFIG: "remote_host=10.254.254.254"
volumes:
- .:/var/www/app/php-demo
```
* The AWS keys aren't necessary unless you're running the Facerace demo. For more information about using XDEBUG with PHPStorm, go to: https://gist.github.com/coleca/c227543fbed515e4eb4c058a7455c581

3. Run the following commands, which will build your Docker container and execute Docker-Compose run to start up the app locally on your machine:
* Run the following commands, which will build your Docker container and execute Docker-Compose run to start up the app locally on your machine:
```
make build && make run
make build
make run
```
* Once your app is running, you can visit `http://localhost:8080` in your browser to view the demo examples.

* To stop the Docker container:

```
docker stop $(docker ps -q)
```

Once your app is running, you can visit [http://localhost:8080](http://localhost:8080) on your browser to view the demo examples.
Note: This will stop all running containers not just this one

## Make this better

Expand Down
6 changes: 3 additions & 3 deletions php-demo/detect/Detect_API_Tutorial.md
Expand Up @@ -18,15 +18,15 @@ You will receive a confirmation email. Click on the link in the email, to activ

#### Running the app on your local system

The application must be run from a server, such as MAMP, WAMP, LAMP OR XAMPP, or another type of virtual machine.
The application can be run from a server, such as MAMP, WAMP, LAMP OR XAMPP, or another type of virtual machine.

Insert your Kairos API ID and Key into the config.php file, which is at the root of the demo directory.

![Config File](/php-demo/detect/docs/config_file.png?raw=true)

The detect demo should render at the the host that you designated in your stack or virtual machine.
The detect demo should render at the the host that you designated in your stack or virtual machine. {host}/detect/

{host}/detect/
NOTE: The webcam functionality requires that your app has SSL enabled. To do this, you can create a self-signed certificate and key and add these to your config settings. MAMP Pro will create the certificate files and then add them to your config automatically. If you're using Apache, the standard SSL port will be 443, so your demo will render here: https://{host}/demo/

#### Running the app in Docker

Expand Down
46 changes: 2 additions & 44 deletions php-demo/detect/README.md
Expand Up @@ -93,50 +93,8 @@ If `?option-panel=yes` is added to the URL of the demo, a panel is revealed unde
---
## Installation

First, enter your personal keys into the docker-compose.yml file:

version: '2'
services:
demo:
image: demo
expose:
- "8080"
ports:
- "8080:80"
environment:
STAGE: prod
AWS_S3_REGION: "your-aws-s3-region"
AWS_S3_UPLOAD_BUCKET: "your-aws-upload-bucket"
APP_ID: "your-app-id"
APP_KEY: "your-app-key"
API_URL: "https://api.kairos.com"
API_TIMEOUT: "10"
POLL_TIMEOUT: "300"
DEMO1_ID: "leave-blank"
DEMO_SECRET_KEY: "leave-blank"
XDEBUG: "true"
XDEBUG_CONFIG: "remote_host=10.254.254.254"
volumes:
- .:/var/www/app/php-demo
The AWS keys aren't necessary unless you're running the Facerace demo. For more information about using XDEBUG with PHPStorm, go to: https://gist.github.com/coleca/c227543fbed515e4eb4c058a7455c581


Then, cd to your demo repo, and run:
```
make build
make run
```
You will then be able to access the UI at http://localhost:8080:80 (if running using Docker for Mac or Docker for Windows)

To stop the Docker container:

```
docker stop $(docker ps -q)
```

Note: This will stop all running containers not just this one

See `INSTALLATION` in the main php-demo README file: [Installation](/php-demo/README.md)

---
## Environment Variables
Expand Down
6 changes: 3 additions & 3 deletions php-demo/emotion/Emotion_API_Tutorial.md
Expand Up @@ -24,15 +24,15 @@ You will receive a confirmation email. Click on the link in the email, to activ

#### Running the app on your local system

The application must be run from a server, such as MAMP, WAMP, LAMP OR XAMPP, or another type of virtual machine.
The application can be run from a server, such as MAMP, WAMP, LAMP OR XAMPP, or another type of virtual machine.

Insert your Kairos API ID and Key into the config.php file, which is at the root of the demo directory.

![Config File](/php-demo/emotion/docs/config_file.png?raw=true)

The emotion demo should render at the the host that you designated in your stack or virtual machine.
The emotion demo should render at the the host that you designated in your stack or virtual machine. {host}/emotion/

{host}/emotion/
NOTE: The webcam functionality requires that your app has SSL enabled. To do this, you can create a self-signed certificate and key and add these to your config settings. MAMP Pro will create the certificate files and then add them to your config automatically. If you're using Apache, the standard SSL port will be 443, so your demo will render here: https://{host}/demo/emotion

#### Running the app in Docker

Expand Down
44 changes: 1 addition & 43 deletions php-demo/emotion/README.md
Expand Up @@ -182,50 +182,8 @@ If `?option-panel=yes` is added to the URL of the demo, a panel is revealed unde
---
## Installation

First, enter your personal keys into the docker-compose.yml file:

version: '2'
services:
demo:
image: demo
expose:
- "8080"
ports:
- "8080:80"
environment:
STAGE: prod
AWS_S3_REGION: "your-aws-s3-region"
AWS_S3_UPLOAD_BUCKET: "your-aws-upload-bucket"
APP_ID: "your-app-id"
APP_KEY: "your-app-key"
API_URL: "https://api.kairos.com"
API_TIMEOUT: "10"
POLL_TIMEOUT: "300"
DEMO1_ID: "leave-blank"
DEMO_SECRET_KEY: "leave-blank"
XDEBUG: "true"
XDEBUG_CONFIG: "remote_host=10.254.254.254"
volumes:
- .:/var/www/app/php-demo
The AWS keys aren't necessary unless you're running the Facerace demo. For more information about using XDEBUG with PHPStorm, go to: https://gist.github.com/coleca/c227543fbed515e4eb4c058a7455c581


Then, cd to your demo repo, and run:
```
make build
make run
```
You will then be able to access the UI at http://localhost:8080:80 (if running using Docker for Mac or Docker for Windows)

To stop the Docker container:

```
docker stop $(docker ps -q)
```

Note: This will stop all running containers not just this one
See `INSTALLATION` in the main php-demo README file: [Installation](/php-demo/README.md)

---
## Environment Variables
Expand Down
46 changes: 2 additions & 44 deletions php-demo/facerace/README.md
Expand Up @@ -38,50 +38,8 @@ The uploaded image and ethnicity metrics are saved as an image on S3 and can be
---
## Installation

First, enter your personal keys into the docker-compose.yml file:

version: '2'
services:
demo:
image: demo
expose:
- "8080"
ports:
- "8080:80"
environment:
STAGE: prod
AWS_S3_REGION: "your-aws-s3-region"
AWS_S3_UPLOAD_BUCKET: "your-aws-upload-bucket"
APP_ID: "your-app-id"
APP_KEY: "your-app-key"
API_URL: "https://api.kairos.com"
API_TIMEOUT: "10"
POLL_TIMEOUT: "300"
DEMO1_ID: "leave-blank"
DEMO_SECRET_KEY: "leave-blank"
XDEBUG: "true"
XDEBUG_CONFIG: "remote_host=10.254.254.254"
volumes:
- .:/var/www/app/php-demo
The AWS keys aren't necessary unless you're running the Facerace demo. For more information about using XDEBUG with PHPStorm, go to: https://gist.github.com/coleca/c227543fbed515e4eb4c058a7455c581


Then, cd to your demo repo, and run:
```
make build
make run
```
You will then be able to access the UI at http://localhost:8080:80 (if running using Docker for Mac or Docker for Windows)

To stop the Docker container:

```
docker stop $(docker ps -q)
```

Note: This will stop all running containers not just this one

See `INSTALLATION` in the main php-demo README file: [Installation](/php-demo/README.md)

---
## Environment Variables
Expand Down
46 changes: 2 additions & 44 deletions php-demo/recognize/README.md
Expand Up @@ -72,50 +72,8 @@ If `?option-panel=yes` is added to the URL of the demo, a panel is revealed unde
---
## Installation

First, enter your personal keys into the docker-compose.yml file:

version: '2'
services:
demo:
image: demo
expose:
- "8080"
ports:
- "8080:80"
environment:
STAGE: prod
AWS_S3_REGION: "your-aws-s3-region"
AWS_S3_UPLOAD_BUCKET: "your-aws-upload-bucket"
APP_ID: "your-app-id"
APP_KEY: "your-app-key"
API_URL: "https://api.kairos.com"
API_TIMEOUT: "10"
POLL_TIMEOUT: "300"
DEMO1_ID: "leave-blank"
DEMO_SECRET_KEY: "leave-blank"
XDEBUG: "true"
XDEBUG_CONFIG: "remote_host=10.254.254.254"
volumes:
- .:/var/www/app/php-demo
The AWS keys aren't necessary unless you're running the Facerace demo. For more information about using XDEBUG with PHPStorm, go to: https://gist.github.com/coleca/c227543fbed515e4eb4c058a7455c581


Then, cd to your demo repo, and run:
```
make build
make run
```
You will then be able to access the UI at http://localhost:8080:80 (if running using Docker for Mac or Docker for Windows)

To stop the Docker container:

```
docker stop $(docker ps -q)
```

Note: This will stop all running containers not just this one

See `INSTALLATION` in the main php-demo README file: [Installation](/php-demo/README.md)

---

Expand Down
3 changes: 1 addition & 2 deletions php-demo/recognize/Recognize_API_Tutorial.md
Expand Up @@ -30,9 +30,8 @@ Insert your Kairos API ID and Key into the config.php file, which is at the root

![Config File](/php-demo/recognize/docs/config_file.png?raw=true)

The recognize demo should render at the the host that you designated in your stack or virtual machine.
The recognize demo should render at the the host that you designated in your stack or virtual machine. {host}/recognize/

{host}/recognize/

#### Running the app in Docker

Expand Down

0 comments on commit 06b62cc

Please sign in to comment.