Skip to content

Commit

Permalink
add symfony and doctrine
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Jun 13, 2024
1 parent b95c3aa commit 7b4c656
Show file tree
Hide file tree
Showing 23 changed files with 4,829 additions and 2,592 deletions.
22 changes: 22 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=53ed3ef67433fbe875020eaee73acb0d
###< symfony/framework-bundle ###

DATABASE_URL="postgresql://root:password@postgres/app?serverVersion=16&charset=utf8"
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ jobs:
ci:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: "root"
POSTGRES_DB: "app"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@v2

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
.php-cs-fixer.cache
.phpunit.cache
/.idea/
/var/
/.env.local
/.env.local.php
/.env.*.local
4 changes: 4 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/bin')
->in(__DIR__.'/config')
->in(__DIR__.'/migrations')
->in(__DIR__.'/public')
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM php:8.3
RUN apt-get update -yqq
RUN apt-get install -y libzip-dev zip wget git procps
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions decimal
RUN install-php-extensions pdo_pgsql decimal
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini
21 changes: 21 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php

use Akondas\Library\Common\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_dir(dirname(__DIR__).'/vendor')) {
throw new LogicException('Dependencies are missing. Try running "composer install".');
}

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
24 changes: 22 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
],
"require": {
"php": "^8.3",
"doctrine/doctrine-bundle": "^2.12",
"doctrine/doctrine-migrations-bundle": "^3.3",
"fale/isbn": "^3.1",
"munusphp/munus": "^0.16",
"symfony/uid": "^7.1"
"symfony/console": "^7.1",
"symfony/dotenv": "^7.1",
"symfony/framework-bundle": "^7.1",
"symfony/runtime": "^7.1",
"symfony/uid": "^7.1",
"symfony/yaml": "^7.1"
},
"require-dev": {
"behat/behat": "^3.14",
Expand Down Expand Up @@ -52,13 +59,26 @@
],
"ci": [
"composer validate",
"composer audit",
"@tests:database:reset",
"@check-cs",
"@phpstan",
"@phpunit",
"@behat"
],
"database:reset": [
"bin/console d:d:d -f -n --if-exists",
"bin/console d:d:c -n",
"bin/console d:m:m -n"
],
"tests:database:reset": [
"APP_ENV=test composer database:reset"
]
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"symfony/runtime": true
}
}
}
Loading

0 comments on commit 7b4c656

Please sign in to comment.