diff --git a/.env b/.env index 1c3d792..5021a1d 100644 --- a/.env +++ b/.env @@ -1,19 +1,26 @@ # This file defines all environment variables that the application needs. +# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE. # Use ".env.local" for local overrides during development. # Use real environment variables when deploying to production. # https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration ###> symfony/framework-bundle ### APP_ENV=dev -APP_SECRET=558a40bd107371e7f7f25b4adf2d0da9 +APP_SECRET=879a6adeceeccbdc835a19f7e3aad7e8 #TRUSTED_PROXIES=127.0.0.1,127.0.0.2 -#TRUSTED_HOSTS=localhost,example.com +#TRUSTED_HOSTS='^localhost|example\.com$' ###< symfony/framework-bundle ### ###> doctrine/doctrine-bundle ### # Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url # For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" # Configure your db driver and server_version in config/packages/doctrine.yaml -#DATABASE_URL=pgsql://db_user:db_password@127.0.0.1:5432/db_name DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db ###< doctrine/doctrine-bundle ### + +###> symfony/swiftmailer-bundle ### +# For Gmail as a transport, use: "gmail://username:password@localhost" +# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" +# Delivery is disabled by default via "null://localhost" +MAILER_URL=null://localhost +###< symfony/swiftmailer-bundle ### diff --git a/.env.dist b/.env.dist new file mode 100644 index 0000000..cf685ce --- /dev/null +++ b/.env.dist @@ -0,0 +1,24 @@ +# This file is a "template" of which env vars need to be defined for your application +# Copy this file to .env file for development, create environment variables when deploying to production +# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration + +###> symfony/framework-bundle ### +APP_ENV=dev +APP_SECRET=9d74944d92d8155f1c870695def94464 +#TRUSTED_PROXIES=127.0.0.1,127.0.0.2 +#TRUSTED_HOSTS=localhost,example.com +###< symfony/framework-bundle ### + +###> doctrine/doctrine-bundle ### +# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db" +# Configure your db driver and server_version in config/packages/doctrine.yaml +DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name +###< doctrine/doctrine-bundle ### + +###> symfony/swiftmailer-bundle ### +# For Gmail as a transport, use: "gmail://username:password@localhost" +# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode=" +# Delivery is disabled by default via "null://localhost" +MAILER_URL=null://localhost +###< symfony/swiftmailer-bundle ### diff --git a/.env.test b/.env.test index 5ae9f7d..414430e 100644 --- a/.env.test +++ b/.env.test @@ -1,6 +1,4 @@ # define your env variables for the test env here -KERNEL_CLASS=App\\Kernel +KERNEL_CLASS='App\Kernel' APP_SECRET='s$cretf0rt3st' -SHELL_VERBOSITY=-1 SYMFONY_DEPRECATIONS_HELPER=999999 -SYMFONY_PHPUNIT_VERSION=6.5 diff --git a/.gitignore b/.gitignore index a212d26..b6a156a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,11 +7,11 @@ /vendor/ ###< symfony/framework-bundle ### -###> symfony/web-server-bundle ### -/.web-server-pid -###< symfony/web-server-bundle ### - ###> symfony/phpunit-bridge ### .phpunit /phpunit.xml ###< symfony/phpunit-bridge ### + +###> symfony/web-server-bundle ### +/.web-server-pid +###< symfony/web-server-bundle ### diff --git a/bin/console b/bin/console index f63add0..0d0ea9f 100755 --- a/bin/console +++ b/bin/console @@ -3,6 +3,7 @@ use App\Kernel; use Symfony\Bundle\FrameworkBundle\Console\Application; +use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Debug\Debug; set_time_limit(0); @@ -10,11 +11,21 @@ set_time_limit(0); require dirname(__DIR__).'/vendor/autoload.php'; if (!class_exists(Application::class)) { - throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.'); + throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.'); } -Kernel::bootstrapCli($_SERVER['argv']); -Kernel::bootstrapEnv(); +$input = new ArgvInput(); +if (null !== $_ENV['APP_ENV'] = $input->getParameterOption(['--env', '-e'], null, true)) { + putenv('APP_ENV='.$_ENV['APP_ENV']); + // force loading .env files when --env is defined + $_SERVER['APP_ENV'] = null; +} + +if ($input->hasParameterOption('--no-debug', true)) { + putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); +} + +require dirname(__DIR__).'/src/.bootstrap.php'; if ($_SERVER['APP_DEBUG']) { umask(0000); @@ -26,4 +37,4 @@ if ($_SERVER['APP_DEBUG']) { $kernel = new Kernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG']); $application = new Application($kernel); -$application->run(); +$application->run($input); diff --git a/bin/phpunit b/bin/phpunit index f28f65f..cd7e32e 100755 --- a/bin/phpunit +++ b/bin/phpunit @@ -6,10 +6,9 @@ if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-php exit(1); } -$classLoader = require dirname(__DIR__).'/vendor/autoload.php'; -App\Kernel::bootstrapEnv('test'); -$classLoader->unregister(); - +if (false === getenv('SYMFONY_PHPUNIT_VERSION')) { + putenv('SYMFONY_PHPUNIT_VERSION=6.5'); +} if (false === getenv('SYMFONY_PHPUNIT_REMOVE')) { putenv('SYMFONY_PHPUNIT_REMOVE='); } diff --git a/composer.json b/composer.json index fa6cf45..4084c3c 100644 --- a/composer.json +++ b/composer.json @@ -6,25 +6,32 @@ "ext-ctype": "*", "ext-iconv": "*", "friendsofsymfony/rest-bundle": "^2.4", - "sensio/framework-extra-bundle": "^5.2", + "sensio/framework-extra-bundle": "^5.1", + "symfony/asset": "4.1.*", "symfony/console": "4.1.*", + "symfony/expression-language": "4.1.*", "symfony/flex": "^1.1", + "symfony/form": "4.1.*", "symfony/framework-bundle": "4.1.*", - "symfony/monolog-bundle": "^3.3", - "symfony/orm-pack": "^1.0", + "symfony/monolog-bundle": "^3.1", + "symfony/orm-pack": "*", + "symfony/process": "4.1.*", "symfony/security-bundle": "4.1.*", - "symfony/serializer-pack": "^1.0", + "symfony/serializer-pack": "*", + "symfony/swiftmailer-bundle": "^3.1", "symfony/translation": "4.1.*", "symfony/twig-bundle": "4.1.*", + "symfony/validator": "4.1.*", + "symfony/web-link": "4.1.*", "symfony/yaml": "4.1.*" }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "^3.0", - "symfony/debug-pack": "^1.0", + "symfony/debug-pack": "*", "symfony/dotenv": "4.1.*", - "symfony/maker-bundle": "^1.9", - "symfony/profiler-pack": "^1.0", - "symfony/test-pack": "^1.0", + "symfony/maker-bundle": "^1.0", + "symfony/profiler-pack": "*", + "symfony/test-pack": "*", "symfony/web-server-bundle": "4.1.*" }, "config": { diff --git a/composer.lock b/composer.lock index a4d0d80..65c7cab 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b65a4ec66949d2db2ea7719835a866e1", + "content-hash": "10b6cfca6b9bb2b93be33c223583ee01", "packages": [ { "name": "doctrine/annotations", @@ -1173,6 +1173,117 @@ ], "time": "2018-06-14T14:45:07+00:00" }, + { + "name": "egulias/email-validator", + "version": "2.1.6", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "0578b32b30b22de3e8664f797cf846fc9246f786" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786", + "reference": "0578b32b30b22de3e8664f797cf846fc9246f786", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^1.0.1", + "php": ">= 5.5" + }, + "require-dev": { + "dominicsayers/isemail": "dev-master", + "phpunit/phpunit": "^4.8.35||^5.7||^6.0", + "satooshi/php-coveralls": "^1.0.1" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "EmailValidator" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "time": "2018-09-25T20:47:26+00:00" + }, + { + "name": "fig/link-util", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link-util.git", + "reference": "1a07821801a148be4add11ab0603e4af55a72fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link-util/zipball/1a07821801a148be4add11ab0603e4af55a72fac", + "reference": "1a07821801a148be4add11ab0603e4af55a72fac", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "psr/link": "~1.0@dev" + }, + "require-dev": { + "phpunit/phpunit": "^5.1", + "squizlabs/php_codesniffer": "^2.3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common utility implementations for HTTP links", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "time": "2016-10-17T18:31:11+00:00" + }, { "name": "friendsofsymfony/rest-bundle", "version": "2.4.0", @@ -1769,6 +1880,55 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/link", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link.git", + "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link/zipball/eea8e8662d5cd3ae4517c9b864493f59fca95562", + "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for HTTP links", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "time": "2016-10-28T16:06:13+00:00" + }, { "name": "psr/log", "version": "1.0.2", @@ -1935,6 +2095,121 @@ ], "time": "2018-10-26T14:09:02+00:00" }, + { + "name": "swiftmailer/swiftmailer", + "version": "v6.1.3", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4", + "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4", + "shasum": "" + }, + "require": { + "egulias/email-validator": "~2.0", + "php": ">=7.0.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.3@dev" + }, + "suggest": { + "ext-intl": "Needed to support internationalized email addresses", + "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "https://swiftmailer.symfony.com", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2018-09-11T07:12:52+00:00" + }, + { + "name": "symfony/asset", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/asset.git", + "reference": "7bec13dad0df8146ee6ba9350203fcc832814bfe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/asset/zipball/7bec13dad0df8146ee6ba9350203fcc832814bfe", + "reference": "7bec13dad0df8146ee6ba9350203fcc832814bfe", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "require-dev": { + "symfony/http-foundation": "~3.4|~4.0", + "symfony/http-kernel": "~3.4|~4.0" + }, + "suggest": { + "symfony/http-foundation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Asset\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Asset Component", + "homepage": "https://symfony.com", + "time": "2018-07-26T09:10:45+00:00" + }, { "name": "symfony/cache", "version": "v4.1.7", @@ -2405,6 +2680,56 @@ "homepage": "https://symfony.com", "time": "2018-10-10T13:52:42+00:00" }, + { + "name": "symfony/expression-language", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/expression-language.git", + "reference": "065bba63c61c96fd2d4fbd01b28de058e6f8779a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/065bba63c61c96fd2d4fbd01b28de058e6f8779a", + "reference": "065bba63c61c96fd2d4fbd01b28de058e6f8779a", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/cache": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\ExpressionLanguage\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony ExpressionLanguage Component", + "homepage": "https://symfony.com", + "time": "2018-07-26T09:10:45+00:00" + }, { "name": "symfony/filesystem", "version": "v4.1.7", @@ -2506,16 +2831,16 @@ }, { "name": "symfony/flex", - "version": "v1.1.7", + "version": "v1.1.8", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "803c49664ddc7cbc4be02f41491766be32c90a7f" + "reference": "955774ecf07b10230bb5b44e150ba078b45f68fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/803c49664ddc7cbc4be02f41491766be32c90a7f", - "reference": "803c49664ddc7cbc4be02f41491766be32c90a7f", + "url": "https://api.github.com/repos/symfony/flex/zipball/955774ecf07b10230bb5b44e150ba078b45f68fa", + "reference": "955774ecf07b10230bb5b44e150ba078b45f68fa", "shasum": "" }, "require": { @@ -2549,35 +2874,116 @@ } ], "description": "Composer plugin for Symfony", - "time": "2018-11-12T12:25:13+00:00" + "time": "2018-11-15T06:11:38+00:00" }, { - "name": "symfony/framework-bundle", + "name": "symfony/form", "version": "v4.1.7", "source": { "type": "git", - "url": "https://github.com/symfony/framework-bundle.git", - "reference": "5f05a52128de2fdd1285bd58d19a912a97bd290f" + "url": "https://github.com/symfony/form.git", + "reference": "c686aef2f1ef79896496982ad65a6eab4110c1e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/5f05a52128de2fdd1285bd58d19a912a97bd290f", - "reference": "5f05a52128de2fdd1285bd58d19a912a97bd290f", + "url": "https://api.github.com/repos/symfony/form/zipball/c686aef2f1ef79896496982ad65a6eab4110c1e0", + "reference": "c686aef2f1ef79896496982ad65a6eab4110c1e0", "shasum": "" }, "require": { - "ext-xml": "*", "php": "^7.1.3", - "symfony/cache": "~3.4|~4.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "^4.1.1", - "symfony/event-dispatcher": "^4.1", - "symfony/filesystem": "~3.4|~4.0", - "symfony/finder": "~3.4|~4.0", - "symfony/http-foundation": "^4.1", - "symfony/http-kernel": "^4.1", - "symfony/polyfill-mbstring": "~1.0", - "symfony/routing": "^4.1" + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/intl": "~3.4|~4.0", + "symfony/options-resolver": "~3.4|~4.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0", + "symfony/property-access": "~3.4|~4.0" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/dependency-injection": "<3.4", + "symfony/doctrine-bridge": "<3.4", + "symfony/framework-bundle": "<3.4", + "symfony/http-kernel": "<3.4", + "symfony/twig-bridge": "<3.4.5|<4.0.5,>=4.0" + }, + "require-dev": { + "doctrine/collections": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/http-foundation": "~3.4|~4.0", + "symfony/http-kernel": "~3.4|~4.0", + "symfony/security-csrf": "~3.4|~4.0", + "symfony/translation": "~3.4|~4.0", + "symfony/validator": "~3.4|~4.0", + "symfony/var-dumper": "~3.4|~4.0" + }, + "suggest": { + "symfony/framework-bundle": "For templating with PHP.", + "symfony/security-csrf": "For protecting forms against CSRF attacks.", + "symfony/twig-bridge": "For templating with Twig.", + "symfony/validator": "For form validation." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Form\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Form Component", + "homepage": "https://symfony.com", + "time": "2018-10-30T17:00:46+00:00" + }, + { + "name": "symfony/framework-bundle", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/framework-bundle.git", + "reference": "5f05a52128de2fdd1285bd58d19a912a97bd290f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/5f05a52128de2fdd1285bd58d19a912a97bd290f", + "reference": "5f05a52128de2fdd1285bd58d19a912a97bd290f", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "php": "^7.1.3", + "symfony/cache": "~3.4|~4.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "^4.1.1", + "symfony/event-dispatcher": "^4.1", + "symfony/filesystem": "~3.4|~4.0", + "symfony/finder": "~3.4|~4.0", + "symfony/http-foundation": "^4.1", + "symfony/http-kernel": "^4.1", + "symfony/polyfill-mbstring": "~1.0", + "symfony/routing": "^4.1" }, "conflict": { "phpdocumentor/reflection-docblock": "<3.0", @@ -2867,6 +3273,81 @@ ], "time": "2018-07-26T08:55:25+00:00" }, + { + "name": "symfony/intl", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/intl.git", + "reference": "61f4a460d12ef20abfd6a8d80f3b19b6997fdf28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/intl/zipball/61f4a460d12ef20abfd6a8d80f3b19b6997fdf28", + "reference": "61f4a460d12ef20abfd6a8d80f3b19b6997fdf28", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-intl-icu": "~1.0" + }, + "require-dev": { + "symfony/filesystem": "~3.4|~4.0" + }, + "suggest": { + "ext-intl": "to use the component with locales other than \"en\"" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Intl\\": "" + }, + "classmap": [ + "Resources/stubs" + ], + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Eriksen Costa", + "email": "eriksen.costa@infranology.com.br" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A PHP replacement layer for the C intl extension that includes additional data from the ICU library.", + "homepage": "https://symfony.com", + "keywords": [ + "i18n", + "icu", + "internationalization", + "intl", + "l10n", + "localization" + ], + "time": "2018-10-31T09:30:44+00:00" + }, { "name": "symfony/monolog-bridge", "version": "v4.1.7", @@ -2997,6 +3478,60 @@ ], "time": "2018-11-04T09:58:13+00:00" }, + { + "name": "symfony/options-resolver", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "40f0e40d37c1c8a762334618dea597d64bbb75ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/40f0e40d37c1c8a762334618dea597d64bbb75ff", + "reference": "40f0e40d37c1c8a762334618dea597d64bbb75ff", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2018-09-18T12:45:12+00:00" + }, { "name": "symfony/orm-pack", "version": "v1.0.5", @@ -3025,6 +3560,64 @@ "description": "A pack for the Doctrine ORM", "time": "2017-12-12T01:47:50+00:00" }, + { + "name": "symfony/polyfill-intl-icu", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-icu.git", + "reference": "f22a90256d577c7ef7efad8df1f0201663d57644" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/f22a90256d577c7ef7efad8df1f0201663d57644", + "reference": "f22a90256d577c7ef7efad8df1f0201663d57644", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/intl": "~2.3|~3.0|~4.0" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's ICU-related data and classes", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "icu", + "intl", + "polyfill", + "portable", + "shim" + ], + "time": "2018-08-06T14:22:27+00:00" + }, { "name": "symfony/polyfill-mbstring", "version": "v1.10.0", @@ -3084,6 +3677,55 @@ ], "time": "2018-09-21T13:07:52+00:00" }, + { + "name": "symfony/process", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/3e83acef94d979b1de946599ef86b3a352abcdc9", + "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-10-14T20:48:13+00:00" + }, { "name": "symfony/property-access", "version": "v4.1.7", @@ -3567,13 +4209,75 @@ "symfony/property-info": "^3.3|^4.0", "symfony/serializer": "^3.3|^4.0" }, - "type": "symfony-pack", + "type": "symfony-pack", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A pack for the Symfony serializer", + "time": "2017-12-12T01:48:53+00:00" + }, + { + "name": "symfony/swiftmailer-bundle", + "version": "v3.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/swiftmailer-bundle.git", + "reference": "bd47db86d0b8415f6317c2be149bbacfab11a9cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/bd47db86d0b8415f6317c2be149bbacfab11a9cf", + "reference": "bd47db86d0b8415f6317c2be149bbacfab11a9cf", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "swiftmailer/swiftmailer": "^6.0.1", + "symfony/config": "~2.8|~3.3|~4.0", + "symfony/dependency-injection": "~2.7|~3.3|~4.0", + "symfony/http-kernel": "~2.7|~3.3|~4.0" + }, + "require-dev": { + "symfony/console": "~2.7|~3.3|~4.0", + "symfony/framework-bundle": "~2.7|~3.3|~4.0", + "symfony/phpunit-bridge": "~3.3|~4.0", + "symfony/yaml": "~2.7|~3.3|~4.0" + }, + "suggest": { + "psr/log": "Allows logging" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bundle\\SwiftmailerBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "A pack for the Symfony serializer", - "time": "2017-12-12T01:48:53+00:00" + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony SwiftmailerBundle", + "homepage": "http://symfony.com", + "time": "2018-10-27T16:17:38+00:00" }, { "name": "symfony/templating", @@ -3864,6 +4568,163 @@ "homepage": "https://symfony.com", "time": "2018-10-30T17:00:46+00:00" }, + { + "name": "symfony/validator", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/validator.git", + "reference": "efa06dd08afa7965b55f29aa5654c98e00528583" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/validator/zipball/efa06dd08afa7965b55f29aa5654c98e00528583", + "reference": "efa06dd08afa7965b55f29aa5654c98e00528583", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0", + "symfony/translation": "~3.4|~4.0" + }, + "conflict": { + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0", + "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<3.4", + "symfony/intl": "<4.1", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.0", + "egulias/email-validator": "^1.2.8|~2.0", + "symfony/cache": "~3.4|~4.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/http-foundation": "~4.1", + "symfony/http-kernel": "~3.4|~4.0", + "symfony/intl": "~4.1", + "symfony/property-access": "~3.4|~4.0", + "symfony/var-dumper": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", + "doctrine/cache": "For using the default cached annotation reader and metadata cache.", + "egulias/email-validator": "Strict (RFC compliant) email validation", + "psr/cache-implementation": "For using the metadata cache.", + "symfony/config": "", + "symfony/expression-language": "For using the Expression validator", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/property-access": "For accessing properties within comparison constraints", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Validator\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Validator Component", + "homepage": "https://symfony.com", + "time": "2018-10-14T19:02:12+00:00" + }, + { + "name": "symfony/web-link", + "version": "v4.1.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/web-link.git", + "reference": "11788d1e5a32783020c261f864422e39bcf044df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/web-link/zipball/11788d1e5a32783020c261f864422e39bcf044df", + "reference": "11788d1e5a32783020c261f864422e39bcf044df", + "shasum": "" + }, + "require": { + "fig/link-util": "^1.0", + "php": "^7.1.3", + "psr/link": "^1.0" + }, + "require-dev": { + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/http-foundation": "~3.4|~4.0", + "symfony/http-kernel": "~3.4|~4.0" + }, + "suggest": { + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\WebLink\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony WebLink Component", + "homepage": "https://symfony.com", + "keywords": [ + "dns-prefetch", + "http", + "http2", + "link", + "performance", + "prefetch", + "preload", + "prerender", + "psr13", + "push" + ], + "time": "2018-07-26T09:10:45+00:00" + }, { "name": "symfony/yaml", "version": "v4.1.7", @@ -4412,6 +5273,66 @@ ], "time": "2018-07-27T15:41:37+00:00" }, + { + "name": "facebook/webdriver", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/facebook/php-webdriver.git", + "reference": "bd8c740097eb9f2fc3735250fc1912bc811a954e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/bd8c740097eb9f2fc3735250fc1912bc811a954e", + "reference": "bd8c740097eb9f2fc3735250fc1912bc811a954e", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-zip": "*", + "php": "^5.6 || ~7.0", + "symfony/process": "^2.8 || ^3.1 || ^4.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "php-coveralls/php-coveralls": "^2.0", + "php-mock/php-mock-phpunit": "^1.1", + "phpunit/phpunit": "^5.7", + "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0", + "squizlabs/php_codesniffer": "^2.6", + "symfony/var-dumper": "^3.3 || ^4.0" + }, + "suggest": { + "ext-SimpleXML": "For Firefox profile creation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-community": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "A PHP client for Selenium WebDriver", + "homepage": "https://github.com/facebook/php-webdriver", + "keywords": [ + "facebook", + "php", + "selenium", + "webdriver" + ], + "time": "2018-05-16T17:37:13+00:00" + }, { "name": "nikic/php-parser", "version": "v4.1.0", @@ -4848,6 +5769,75 @@ ], "time": "2018-11-03T18:25:11+00:00" }, + { + "name": "symfony/panther", + "version": "v0.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/panther.git", + "reference": "d67f9dbcac173150fe00673e6564b3482762c615" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/panther/zipball/d67f9dbcac173150fe00673e6564b3482762c615", + "reference": "d67f9dbcac173150fe00673e6564b3482762c615", + "shasum": "" + }, + "require": { + "facebook/webdriver": "^1.5", + "php": ">=7.1", + "symfony/browser-kit": "^4.0", + "symfony/polyfill-php72": "^1.9", + "symfony/process": "^3.4 || ^4.0" + }, + "conflict": { + "symfony/browser-kit": "4.1.0" + }, + "require-dev": { + "fabpot/goutte": "^3.2.3", + "guzzlehttp/guzzle": "^6.3", + "phpunit/phpunit": "^7.0", + "symfony/css-selector": "^3.4 || ^4.0", + "symfony/framework-bundle": "^3.4 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Panther\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Kévin Dunglas", + "email": "dunglas@gmail.com", + "homepage": "https://dunglas.fr" + } + ], + "description": "A browser testing and web scraping library for PHP and Symfony.", + "homepage": "https://dunglas.fr", + "keywords": [ + "e2e", + "scraping", + "selenium", + "symfony", + "testing", + "webdriver" + ], + "time": "2018-09-26T10:35:52+00:00" + }, { "name": "symfony/phpunit-bridge", "version": "v4.1.7", @@ -4969,55 +5959,6 @@ ], "time": "2018-09-21T13:07:52+00:00" }, - { - "name": "symfony/process", - "version": "v4.1.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/3e83acef94d979b1de946599ef86b3a352abcdc9", - "reference": "3e83acef94d979b1de946599ef86b3a352abcdc9", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2018-10-14T20:48:13+00:00" - }, { "name": "symfony/profiler-pack", "version": "v1.0.3", @@ -5097,22 +6038,23 @@ }, { "name": "symfony/test-pack", - "version": "v1.0.2", + "version": "v1.0.4", "source": { "type": "git", "url": "https://github.com/symfony/test-pack.git", - "reference": "958d23627214f5268d211c25031650d0dd6bdf60" + "reference": "94d1c2b02f137201cd6a68d290caa38fe3817cba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/test-pack/zipball/958d23627214f5268d211c25031650d0dd6bdf60", - "reference": "958d23627214f5268d211c25031650d0dd6bdf60", + "url": "https://api.github.com/repos/symfony/test-pack/zipball/94d1c2b02f137201cd6a68d290caa38fe3817cba", + "reference": "94d1c2b02f137201cd6a68d290caa38fe3817cba", "shasum": "" }, "require": { "php": "^7.0", "symfony/browser-kit": "^3.3|^4.0", "symfony/css-selector": "^3.3|^4.0", + "symfony/panther": "*", "symfony/phpunit-bridge": "*" }, "type": "symfony-pack", @@ -5120,8 +6062,8 @@ "license": [ "MIT" ], - "description": "A pack for functional testing within a Symfony app", - "time": "2018-04-30T06:17:59+00:00" + "description": "A pack for functional and end-to-end testing within a Symfony app", + "time": "2018-09-25T09:21:56+00:00" }, { "name": "symfony/var-dumper", diff --git a/config/bundles.php b/config/bundles.php index 7eca8d4..5aa5e43 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -2,17 +2,18 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true], - Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true], + Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true], Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], - Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - FOS\RestBundle\FOSRestBundle::class => ['all' => true], - Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true], + Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true], Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], + FOS\RestBundle\FOSRestBundle::class => ['all' => true], ]; diff --git a/config/orm/Hero.orm.yml b/config/orm/Hero.orm.yml index b491fd2..f2b6bab 100644 --- a/config/orm/Hero.orm.yml +++ b/config/orm/Hero.orm.yml @@ -1,6 +1,6 @@ App\Entity\Hero: type: entity - repositoryClass: App\Entity\Repository\HeroRepository + repositoryClass: App\Repository\HeroRepository table: hero id: id: diff --git a/config/orm/User.orm.yml b/config/orm/User.orm.yml index a912cd5..ee42936 100644 --- a/config/orm/User.orm.yml +++ b/config/orm/User.orm.yml @@ -1,6 +1,6 @@ App\Entity\User: type: entity - repositoryClass: App\Entity\Repository\UserRepository + repositoryClass: App\Repository\UserRepository table: user id: id: diff --git a/config/packages/dev/swiftmailer.yaml b/config/packages/dev/swiftmailer.yaml new file mode 100644 index 0000000..b98158e --- /dev/null +++ b/config/packages/dev/swiftmailer.yaml @@ -0,0 +1,4 @@ +# See https://symfony.com/doc/current/email/dev_environment.html +swiftmailer: + # send all emails to a specific address + #delivery_addresses: ['me@example.com'] diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 1022dd6..70ae343 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -10,7 +10,7 @@ doctrine: # configure these for your database server driver: 'pdo_sqlite' charset: utf8 - + url: '%env(resolve:DATABASE_URL)%' orm: auto_generate_proxy_classes: true diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 0f6fb9c..21cc0c5 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -31,4 +31,4 @@ framework: serializer: { enable_annotations: true } templating: - engines: ['twig'] \ No newline at end of file + engines: ['twig'] diff --git a/config/packages/security.yaml b/config/packages/security.yaml index 1cf5f8f..44814ee 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -18,7 +18,7 @@ security: stateless: true main: anonymous: true - + # activate different ways to authenticate # http_basic: true diff --git a/config/packages/swiftmailer.yaml b/config/packages/swiftmailer.yaml new file mode 100644 index 0000000..cae6508 --- /dev/null +++ b/config/packages/swiftmailer.yaml @@ -0,0 +1,3 @@ +swiftmailer: + url: '%env(MAILER_URL)%' + spool: { type: 'memory' } diff --git a/config/packages/test/swiftmailer.yaml b/config/packages/test/swiftmailer.yaml new file mode 100644 index 0000000..f438078 --- /dev/null +++ b/config/packages/test/swiftmailer.yaml @@ -0,0 +1,2 @@ +swiftmailer: + disable_delivery: true diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml new file mode 100644 index 0000000..a695e1a --- /dev/null +++ b/config/packages/validator.yaml @@ -0,0 +1,3 @@ +framework: + validation: + email_validation_mode: html5 diff --git a/config/services.yaml b/config/services.yaml index 1b73efe..776e6ce 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -27,9 +27,5 @@ services: resource: '../src/Controller' tags: ['controller.service_arguments'] - App\Entity\Repository\: - resource: '../src/Entity/Repository' - - # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e283e8d..65d044a 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,10 +5,13 @@ xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.5/phpunit.xsd" backupGlobals="false" colors="true" - bootstrap="vendor/autoload.php" + bootstrap="src/.bootstrap.php" > + + + diff --git a/public/index.php b/public/index.php index c10bbd5..9b4b36b 100644 --- a/public/index.php +++ b/public/index.php @@ -4,9 +4,7 @@ use App\Kernel; use Symfony\Component\Debug\Debug; use Symfony\Component\HttpFoundation\Request; -require dirname(__DIR__).'/vendor/autoload.php'; - -Kernel::bootstrapEnv(); +require dirname(__DIR__).'/src/.bootstrap.php'; if ($_SERVER['APP_DEBUG']) { umask(0000); @@ -19,7 +17,7 @@ if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? } if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) { - Request::setTrustedHosts(explode(',', $trustedHosts)); + Request::setTrustedHosts([$trustedHosts]); } $kernel = new Kernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG']); diff --git a/src/.bootstrap.php b/src/.bootstrap.php new file mode 100644 index 0000000..8fc9ae9 --- /dev/null +++ b/src/.bootstrap.php @@ -0,0 +1,51 @@ +loadEnv($path); + } else { + // fallback code in case your Dotenv component is not 4.2 or higher (when loadEnv() was added) + + if (file_exists($path) || !file_exists($p = "$path.dist")) { + $dotenv->load($path); + } else { + $dotenv->load($p); + } + + if (null === $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) { + $dotenv->populate(array('APP_ENV' => $env = 'dev')); + } + + if ('test' !== $env && file_exists($p = "$path.local")) { + $dotenv->load($p); + $env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env; + } + + if (file_exists($p = "$path.$env")) { + $dotenv->load($p); + } + + if (file_exists($p = "$path.$env.local")) { + $dotenv->load($p); + } + } +} + +$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $_SERVER['APP_ENV'] ?: $_ENV['APP_ENV'] ?: 'dev'; +$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; +$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; diff --git a/src/Controller/HeroController.php b/src/Controller/HeroController.php index 51e0754..54166cd 100644 --- a/src/Controller/HeroController.php +++ b/src/Controller/HeroController.php @@ -2,10 +2,9 @@ namespace App\Controller; -use App\Entity\Repository\HeroRepository; +use App\Repository\HeroRepository; use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\FOSRestController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; /** @@ -25,7 +24,7 @@ class HeroController extends FOSRestController */ public function cgetAction() { - $heros = $this->heroRepository->findAll(); - return $this->view($heros, Response::HTTP_OK); + $heroes = $this->heroRepository->findAll(); + return $this->view($heroes, Response::HTTP_OK); } } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index a8cd6ff..fcc80e6 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -2,10 +2,9 @@ namespace App\Controller; -use App\Entity\Repository\UserRepository; +use App\Repository\UserRepository; use FOS\RestBundle\Controller\Annotations as Rest; use FOS\RestBundle\Controller\FOSRestController; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; /** diff --git a/src/DataFixtures/UserFixtures.php b/src/DataFixtures/UserFixtures.php index f985c76..fcdbf6d 100644 --- a/src/DataFixtures/UserFixtures.php +++ b/src/DataFixtures/UserFixtures.php @@ -10,8 +10,10 @@ class UserFixtures extends Fixture { public const ADMIN_USER_REFERENCE = 'admin-user'; + public const ADMIN_USER_TOKEN = 'ItsHammerTime!'; public const DUDE_USER_REFERENCE = 'dummy-user'; + public const DUDE_USER_TOKEN = 'ItsDuderzeit!'; private $passwordEncoder; @@ -25,13 +27,13 @@ class UserFixtures extends Fixture $userAdmin = new User(); $userAdmin->setUsername('admin'); $this->setPassword($userAdmin, '123456789'); - $userAdmin->setApiToken('ItsHammerTime!'); + $userAdmin->setApiToken(self::ADMIN_USER_TOKEN); $manager->persist($userAdmin); $userDude = new User(); $userDude->setUsername('dude'); $this->setPassword($userDude, '1234'); - $userDude->setApiToken('ItsDuderzeit!'); + $userDude->setApiToken(self::DUDE_USER_TOKEN); $manager->persist($userDude); $manager->flush(); diff --git a/src/Kernel.php b/src/Kernel.php index e552e52..edb95a0 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -6,7 +6,6 @@ use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\RouteCollectionBuilder; @@ -30,7 +29,7 @@ class Kernel extends BaseKernel { $contents = require $this->getProjectDir().'/config/bundles.php'; foreach ($contents as $class => $envs) { - if (isset($envs['all']) || isset($envs[$this->environment])) { + if ($envs[$this->environment] ?? $envs['all'] ?? false) { yield new $class(); } } @@ -59,82 +58,4 @@ class Kernel extends BaseKernel $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); $routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob'); } - - public static function bootstrapCli(array &$argv) - { - // consume --env and --no-debug from the command line - - // when using symfony/console v4.2 or higher, this should - // be replaced by a call to Application::bootstrapEnv() - - for ($i = 0; $i < \count($argv) && '--' !== $v = $argv[$i]; ++$i) { - if ('--no-debug' === $v) { - putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); - $argvUnset[$i] = true; - break; - } - } - - for ($i = 0; $i < \count($argv) && '--' !== $v = $argv[$i]; ++$i) { - if (!$v || '-' !== $v[0] || !preg_match('/^-(?:-env(?:=|$)|e=?)(.*)$/D', $v, $v)) { - continue; - } - if (!empty($v[1]) || !empty($argv[1 + $i])) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = empty($v[1]) ? $argv[1 + $i] : $v[1]); - $argvUnset[$i] = $argvUnset[$i + empty($v[1])] = true; - } - break; - } - - if (!empty($argvUnset)) { - $argv = array_values(array_diff_key($argv, $argvUnset)); - } - } - - public static function bootstrapEnv($env = null) - { - if (null !== $env) { - putenv('APP_ENV='.$_SERVER['APP_ENV'] = $env); - } - - if ('prod' !== $_SERVER['APP_ENV'] = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) { - if (!class_exists(Dotenv::class)) { - throw new \RuntimeException('The "APP_ENV" environment variable is not defined. You need to set it or run "composer require symfony/dotenv" to load it from a ".env" file.'); - } - - // when using symfony/dotenv v4.2 or higher, this call and the related methods - // below should be replaced by a call to the new Dotenv::loadEnv() method - self::loadEnv(new Dotenv(), \dirname(__DIR__).'/.env'); - } - - $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : 'dev'; - $_SERVER['APP_DEBUG'] = isset($_SERVER['APP_DEBUG']) ? $_SERVER['APP_DEBUG'] : (isset($_ENV['APP_DEBUG']) ? $_ENV['APP_DEBUG'] : 'prod' !== $_SERVER['APP_ENV']); - $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; - } - - private static function loadEnv(Dotenv $dotenv, $path) - { - if (file_exists($path) || !file_exists($p = "$path.dist")) { - $dotenv->load($path); - } else { - $dotenv->load($p); - } - - if (null === $env = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) { - $dotenv->populate(array('APP_ENV' => $env = 'dev')); - } - - if ('test' !== $env && file_exists($p = "$path.local")) { - $dotenv->load($p); - $env = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : $env); - } - - if (file_exists($p = "$path.$env")) { - $dotenv->load($p); - } - - if (file_exists($p = "$path.$env.local")) { - $dotenv->load($p); - } - } } diff --git a/src/Migrations/Version20181118195745.php b/src/Migrations/Version20181118195745.php new file mode 100644 index 0000000..b74ae18 --- /dev/null +++ b/src/Migrations/Version20181118195745.php @@ -0,0 +1,35 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.'); + + $this->addSql('CREATE TABLE hero (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER NOT NULL, name VARCHAR(32) NOT NULL)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_51CE6E865E237E06 ON hero (name)'); + $this->addSql('CREATE INDEX IDX_51CE6E86A76ED395 ON hero (user_id)'); + $this->addSql('CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(32) NOT NULL, password VARCHAR(255) NOT NULL, api_token VARCHAR(255) DEFAULT NULL, roles CLOB NOT NULL --(DC2Type:json) + )'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649F85E0677 ON user (username)'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D6497BA2F5EB ON user (api_token)'); + } + + public function down(Schema $schema) : void + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'sqlite', 'Migration can only be executed safely on \'sqlite\'.'); + + $this->addSql('DROP TABLE hero'); + $this->addSql('DROP TABLE user'); + } +} diff --git a/src/Entity/Repository/HeroRepository.php b/src/Repository/HeroRepository.php similarity index 97% rename from src/Entity/Repository/HeroRepository.php rename to src/Repository/HeroRepository.php index 9d6328d..4a5caac 100644 --- a/src/Entity/Repository/HeroRepository.php +++ b/src/Repository/HeroRepository.php @@ -1,6 +1,6 @@ em = $em; + $this->userRepository = $userRepository; } /** @@ -54,8 +54,7 @@ class TokenAuthenticator extends AbstractGuardAuthenticator } // if a User object, checkCredentials() is called - return $this->em->getRepository(User::class) - ->findOneBy(['apiToken' => $apiToken]); + return $this->userRepository->findOneBy(['apiToken' => $apiToken]); } public function checkCredentials($credentials, UserInterface $user) diff --git a/symfony.lock b/symfony.lock index 63c0a4e..15713d5 100644 --- a/symfony.lock +++ b/symfony.lock @@ -86,6 +86,15 @@ "ref": "70062abc2cd58794d2a90274502f81b55cd9951b" } }, + "egulias/email-validator": { + "version": "2.1.6" + }, + "facebook/webdriver": { + "version": "1.6.0" + }, + "fig/link-util": { + "version": "1.0.0" + }, "friendsofsymfony/rest-bundle": { "version": "2.2", "recipe": { @@ -108,7 +117,7 @@ "version": "1.3.0" }, "ocramius/proxy-manager": { - "version": "2.2.2" + "version": "2.1.1" }, "phpdocumentor/reflection-common": { "version": "1.0.1" @@ -125,6 +134,9 @@ "psr/container": { "version": "1.0.0" }, + "psr/link": { + "version": "1.0.0" + }, "psr/log": { "version": "1.0.2" }, @@ -140,6 +152,12 @@ "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b" } }, + "swiftmailer/swiftmailer": { + "version": "v6.1.3" + }, + "symfony/asset": { + "version": "v4.1.7" + }, "symfony/browser-kit": { "version": "v4.1.7" }, @@ -155,7 +173,7 @@ "repo": "github.com/symfony/recipes", "branch": "master", "version": "3.3", - "ref": "b5026d7ffdb43b4d66f4cc091b1e6f94e6023986" + "ref": "181d766db0eb468f41337f9b2d9d5b61ba1ee441" } }, "symfony/css-selector": { @@ -191,6 +209,9 @@ "symfony/event-dispatcher": { "version": "v4.1.7" }, + "symfony/expression-language": { + "version": "v4.1.7" + }, "symfony/filesystem": { "version": "v4.1.7" }, @@ -203,16 +224,19 @@ "repo": "github.com/symfony/recipes", "branch": "master", "version": "1.0", - "ref": "b96338eb5155c5b97a80e7705abf30aa09c29167" + "ref": "5f8a51c0fad684396f6b6c0fd770e043439cb632" } }, + "symfony/form": { + "version": "v4.1.7" + }, "symfony/framework-bundle": { "version": "3.3", "recipe": { "repo": "github.com/symfony/recipes", "branch": "master", "version": "3.3", - "ref": "2230e9f42b10616b91a28d15ed3a2d984e0b6c10" + "ref": "9ec493d6f3575c54671493d635fa4b68658022ab" } }, "symfony/http-foundation": { @@ -224,6 +248,9 @@ "symfony/inflector": { "version": "v4.1.7" }, + "symfony/intl": { + "version": "v4.1.7" + }, "symfony/maker-bundle": { "version": "1.0", "recipe": { @@ -245,18 +272,27 @@ "ref": "18ebf5a940573a20de06f9c4060101eeb438cf3d" } }, + "symfony/options-resolver": { + "version": "v4.1.7" + }, "symfony/orm-pack": { "version": "v1.0.5" }, + "symfony/panther": { + "version": "v0.2.0" + }, "symfony/phpunit-bridge": { "version": "4.1", "recipe": { "repo": "github.com/symfony/recipes", "branch": "master", "version": "4.1", - "ref": "e637a1337f5faf0b2529b1c9a47de5e8286679f0" + "ref": "b4c7d939cac9a67e02366fa7971746e9cbf1dad0" } }, + "symfony/polyfill-intl-icu": { + "version": "v1.10.0" + }, "symfony/polyfill-mbstring": { "version": "v1.10.0" }, @@ -305,11 +341,20 @@ "symfony/stopwatch": { "version": "v4.1.7" }, + "symfony/swiftmailer-bundle": { + "version": "2.5", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "2.5", + "ref": "3db029c03e452b4a23f7fc45cec7c922c2247eb8" + } + }, "symfony/templating": { "version": "v4.1.7" }, "symfony/test-pack": { - "version": "v1.0.2" + "version": "v1.0.4" }, "symfony/translation": { "version": "3.3", @@ -332,9 +377,21 @@ "ref": "369b5b29dc52b2c190002825ae7ec24ab6f962dd" } }, + "symfony/validator": { + "version": "4.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "4.1", + "ref": "0cdc982334f45d554957a6167e030482795bf9d7" + } + }, "symfony/var-dumper": { "version": "v4.1.7" }, + "symfony/web-link": { + "version": "v4.1.7" + }, "symfony/web-profiler-bundle": { "version": "3.3", "recipe": { diff --git a/tests/Controller/RestTestBase.php b/tests/Controller/RestTestBase.php index 16b6ee0..e189141 100644 --- a/tests/Controller/RestTestBase.php +++ b/tests/Controller/RestTestBase.php @@ -2,7 +2,12 @@ namespace App\Tests\Controller; +use Doctrine\ORM\EntityManagerInterface; +use Symfony\Bundle\FrameworkBundle\Console\Application; +use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\BrowserKit\Client; +use Symfony\Component\Console\Input\StringInput; +use Symfony\Component\Console\Output\NullOutput; class RestTestBase extends WebTestCase { @@ -21,6 +26,7 @@ class RestTestBase extends WebTestCase protected function reloadDoctrineFixtures() { + self::runCommand('doctrine:migration:migrate'); self::runCommand('doctrine:fixtures:load --purge-with-truncate -n'); } diff --git a/tests/Controller/UserControllerTest.php b/tests/Controller/UserControllerTest.php new file mode 100644 index 0000000..1674672 --- /dev/null +++ b/tests/Controller/UserControllerTest.php @@ -0,0 +1,31 @@ +createRequestBuilder() + ->setMethod('GET') + ->setUri('/api/users') + ->setAcceptType('application/json') + ->addServerParameter('HTTP_X-AUTH-TOKEN', UserFixtures::ADMIN_USER_TOKEN) + ->request(); + + $response = $this->client->getResponse(); + + $this->assertTrue( + $response->headers->contains('Content-Type', 'application/json'), + 'the "Content-Type" header is "' . $response->headers->get('Content-Type') . '"' // optional message shown on failure + ); + + $this->assertEquals(200, $response->getStatusCode(), 'Status code was ' . $response->getStatusCode() . ' but expected 200: ' . $response->getContent()); + } + +}