Skip to content

chore: support for local dev and debugging via docker #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor/*
composer.lock
15 changes: 15 additions & 0 deletions Example/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM php:7.4-apache

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

RUN \
pecl install xdebug && \
docker-php-ext-enable xdebug

WORKDIR /var/www/html

COPY . /var/www/html

RUN \
cd Example && \
composer install
21 changes: 21 additions & 0 deletions Example/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "evolv/php-sdk-demo",
"type": "project",
"autoload": {
"psr-4": {
"Evolv\\PhpSdkDemo\\": "src/"
}
},
"repositories": [
{
"type": "path",
"url": "..",
"options": {
"symlink": true
}
}
],
"require": {
"evolv/php-sdk": "@dev"
}
}
5 changes: 3 additions & 2 deletions Example/index.php → Example/src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

declare (strict_types=1);

use Evolv\EvolvClient;

# Must be invoked once at top-level for Composer
require_once __DIR__ . '/../vendor/autoload.php';

use Evolv\EvolvClient;

function display($arr, $title = null)
{
if ($title) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@ evolv/php-sdk
Evolv Delivers Autonomous Optimization Across Web & Mobile.

You can find out more by visiting: <a href="https://www.evolv.ai/">https://www.evolv.ai/</a>

## Local Development

```shell
docker-compose up -d
```
12 changes: 9 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ version: '3.8'
services:
php-apache-environment:
container_name: php-sdk
image: php:7.4-apache
build:
dockerfile: Example/Dockerfile
context: .
volumes:
- ./:/var/www/html/
- ./php.ini:/usr/local/etc/php/php.ini
- .:/var/www/html/
# - /var/www/html/Example/vendor
- ./docker/apache/sites-enabled:/etc/apache2/sites-enabled
# - ./php.ini:/usr/local/etc/php/php.ini
- ./docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- ./docker/php/conf.d/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
ports:
- 8000:80
11 changes: 11 additions & 0 deletions docker/apache/sites-enabled/000-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/Example/src
DirectoryIndex index.php

<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
1 change: 1 addition & 0 deletions docker/php/conf.d/error_reporting.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error_reporting=E_ALL
6 changes: 6 additions & 0 deletions docker/php/conf.d/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
zend_extension=xdebug

[xdebug]
xdebug.mode=develop,debug
xdebug.client_host=host.docker.internal
xdebug.start_with_request=yes