-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOCS-151: Added PHP app to examples (#7)
* DOCS-151: Added PHP app to examples * Updated README
- Loading branch information
1 parent
63c77d3
commit 1b6b4ac
Showing
15 changed files
with
2,546 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Welcome To the Rev.ai Example Repository | ||
|
||
This repository contains examples for using the rev.ai API from either of the provided SDKs (node and python) as well as from browser. | ||
This repository contains examples for using the rev.ai API from either of the provided SDKs (node and python) as well as from PHP and the browser. | ||
|
||
These examples are all for public use. Simply insert your access token where required and you're ready to go. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
REVAI_ACCESS_TOKEN='' | ||
MONGODB_URI='mongodb://myuser:mypassword@mydb' | ||
CALLBACK_PREFIX='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
vendor/* | ||
.env | ||
.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
RewriteEngine on | ||
RewriteRule ^$ public/ [L] | ||
RewriteRule (.*) public/$1 [L] | ||
php_value upload_max_filesize 256M | ||
php_value post_max_size 256M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM php:8.1.8-apache | ||
RUN set -eux; \ | ||
apt-get update; \ | ||
apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev zlib1g-dev zip git; \ | ||
pecl install mongodb; \ | ||
docker-php-ext-enable mongodb; | ||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | ||
WORKDIR /var/www | ||
RUN set -eux; \ | ||
a2enmod rewrite; \ | ||
sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/000-default.conf | ||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# PHP Web Application Example - Voice Notes | ||
|
||
## Requirements | ||
|
||
1. Docker | ||
2. Rev AI access token, available at [https://rev.ai/auth/signup](https://rev.ai/auth/signup). | ||
3. ngrok (only required when running locally or without a public webhook URL) | ||
4. ngrok authentication token available at [https://dashboard.ngrok.com/signup](https://dashboard.ngrok.com/signup) | ||
|
||
## Setup | ||
|
||
1. Clone this repository. Change to the `php_examples/voicenotes` working directory. | ||
2. Rename the `.env.sample` file to `.env`. | ||
3. In the `.env` file, add the Rev AI access token as the value for the environment variable `REVAI_ACCESS_TOKEN`. | ||
4. In the `.env` file, add the callback URL as the value for the environment variable `CALLBACK_PREFIX`. If you are working locally, configure an ngrok tunnel (`ngrok http 80`) and use the ngrok callback URL. | ||
|
||
5. Start the containers, building them if necessary: | ||
|
||
``` | ||
docker-compose up -d --build | ||
``` | ||
|
||
6. Install Composer packages, deleting any older ones that may exist: | ||
|
||
``` | ||
docker exec voicenotes_app rm -rf vendor/ | ||
docker exec voicenotes_app composer install | ||
``` | ||
|
||
7. Browse to `http://YOURDOCKERHOST/index` to use the application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"require": { | ||
"slim/slim": "4.*", | ||
"slim/twig-view": "^3.3", | ||
"php-di/php-di": "^6.4", | ||
"slim/psr7": "^1.5", | ||
"guzzlehttp/guzzle": "7.*", | ||
"mongodb/mongodb": "^1.13" | ||
} | ||
} |
Oops, something went wrong.