Skip to content

Commit

Permalink
symfony flex support has been added
Browse files Browse the repository at this point in the history
  • Loading branch information
semin-lev committed Dec 27, 2017
1 parent 379f1de commit a7fbabe
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/PHPDocker/Generator/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ private function getBinaryFiles(Project $project): array
new BinaryExecutorFile('composer', "#!/bin/bash\ndocker-compose exec php-fpm php /usr/local/bin/composer $*"),
];

if ($project->getApplicationOptions()->getApplicationType()==Application::APPLICATION_TYPE_SYMFONY) {
$appType = $project->getApplicationOptions()->getApplicationType();
if (in_array($appType, Application::SYMFONY_TYPES)) {
$result[] = new BinaryExecutorFile('symfony', "#!/bin/bash\ndocker-compose exec php-fpm php bin/console $*");
}

Expand Down
23 changes: 15 additions & 8 deletions src/PHPDocker/Project/ServiceOptions/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,26 @@ class Application
/**
* Supported application types
*/
const APPLICATION_TYPE_SYMFONY = 'symfony';
const APPLICATION_TYPE_PHALCON = 'phalcon';
const APPLICATION_TYPE_GENERIC = 'generic';
const APPLICATION_TYPE_SILEX = 'silex';
const APPLICATION_TYPE_SYMFONY_FLEX = 'symfony_flex';
const APPLICATION_TYPE_SYMFONY = 'symfony';
const APPLICATION_TYPE_PHALCON = 'phalcon';
const APPLICATION_TYPE_GENERIC = 'generic';
const APPLICATION_TYPE_SILEX = 'silex';

/**
* Allowed application types with short description
*/
const ALLOWED_APPLICATION_TYPES = [
self::APPLICATION_TYPE_GENERIC => 'Generic: Zend, Laravel, Lumen...',
self::APPLICATION_TYPE_SYMFONY => 'Symfony',
self::APPLICATION_TYPE_PHALCON => 'Phalcon 3',
self::APPLICATION_TYPE_SILEX => 'Silex',
self::APPLICATION_TYPE_GENERIC => 'Generic: Zend, Laravel, Lumen...',
self::APPLICATION_TYPE_SYMFONY => 'Symfony',
self::APPLICATION_TYPE_SYMFONY_FLEX => 'Symfony Flex',
self::APPLICATION_TYPE_PHALCON => 'Phalcon 3',
self::APPLICATION_TYPE_SILEX => 'Silex',
];

const SYMFONY_TYPES = [
Application::APPLICATION_TYPE_SYMFONY,
Application::APPLICATION_TYPE_SYMFONY_FLEX
];

/**
Expand Down
6 changes: 4 additions & 2 deletions src/PHPDocker/Template/nginx.conf.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ server {

access_log /var/log/nginx/application.access.log;

{% if applicationType == 'symfony' or applicationType == 'silex' %}
{% if applicationType == 'symfony' or applicationType == 'silex' or applicationType == 'symfony_flex' %}
{% spaceless %}
{% if applicationType == 'symfony' %}
{% set indexFile = 'app' %}
{% else %}
{% set indexFile = 'index' %}
{% endif %}

root /application/web;
{% set rootDir = applicationType == 'symfony_flex' ? '/application/public' : '/application/web' %}

root {{ rootDir }};

rewrite ^/{{ indexFile }}\.php/?(.*)$ /$1 permanent;

Expand Down

0 comments on commit a7fbabe

Please sign in to comment.