Skip to content

Commit a588c0e

Browse files
author
Matt Strom
committed
chore: support for local dev and debugging via docker
1 parent 2dd155f commit a588c0e

File tree

13 files changed

+76
-7
lines changed

13 files changed

+76
-7
lines changed

Example/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/*
2+
composer.lock

Example/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM php:7.4-apache
2+
#FROM php:7.4-fpm
3+
4+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
5+
6+
RUN \
7+
pecl install xdebug && \
8+
docker-php-ext-enable xdebug
9+
10+
WORKDIR /var/www/html
11+
12+
COPY . /var/www/html
13+
14+
RUN \
15+
cd Example && \
16+
composer install

Example/composer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "evolv/php-sdk-demo",
3+
"type": "project",
4+
"autoload": {
5+
"psr-4": {
6+
"Evolv\\PhpSdkDemo\\": "src/"
7+
}
8+
},
9+
"repositories": [
10+
{
11+
"type": "path",
12+
"url": "..",
13+
"options": {
14+
"symlink": true
15+
}
16+
}
17+
],
18+
"require": {
19+
"evolv/php-sdk": "@dev"
20+
}
21+
}

Example/index.php renamed to Example/src/index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare (strict_types=1);
44

5-
use Evolv\EvolvClient;
6-
75
require_once __DIR__ . '/../vendor/autoload.php';
86

7+
use Evolv\EvolvClient;
8+
99
function display($arr, $title = null)
1010
{
1111
if ($title) {
@@ -114,9 +114,9 @@ function display($arr, $title = null)
114114
<div class="row">
115115
<div class="col">
116116
<?php
117-
$environment = '7f4099bfbc';
117+
$environment = '03bb303739';
118118
$uid = 'user_id';
119-
$endpoint = 'https://participants-stg.evolv.ai/';
119+
$endpoint = 'https://participants.evolv.ai/';
120120

121121
$client = new EvolvClient($environment, $endpoint, $autoconfirm = true);
122122
$client->initialize($uid);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ evolv/php-sdk
5151
Evolv Delivers Autonomous Optimization Across Web & Mobile.
5252

5353
You can find out more by visiting: <a href="https://www.evolv.ai/">https://www.evolv.ai/</a>
54+
55+
## Local Development
56+
57+
```shell
58+
docker-compose up -d
59+
```

docker-compose.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ version: '3.8'
33
services:
44
php-apache-environment:
55
container_name: php-sdk
6-
image: php:7.4-apache
6+
build:
7+
dockerfile: Example/Dockerfile
8+
context: .
79
volumes:
8-
- ./:/var/www/html/
9-
- ./php.ini:/usr/local/etc/php/php.ini
10+
- .:/var/www/html/
11+
# - /var/www/html/Example/vendor
12+
- ./docker/apache/sites-enabled:/etc/apache2/sites-enabled
13+
# - ./php.ini:/usr/local/etc/php/php.ini
14+
- ./docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
15+
- ./docker/php/conf.d/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
1016
ports:
1117
- 8000:80
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<VirtualHost *:80>
2+
ServerAdmin webmaster@localhost
3+
DocumentRoot /var/www/html/Example/src
4+
DirectoryIndex index.php
5+
6+
<Directory /var/www/html>
7+
Options Indexes FollowSymLinks
8+
AllowOverride All
9+
Require all granted
10+
</Directory>
11+
</VirtualHost>

docker/php/conf.d/error_reporting.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
error_reporting=E_ALL

docker/php/conf.d/xdebug.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
zend_extension=xdebug
2+
3+
[xdebug]
4+
xdebug.mode=develop,debug
5+
xdebug.client_host=host.docker.internal
6+
xdebug.start_with_request=yes

0 commit comments

Comments
 (0)