diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index abee7a4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: php - -dist: trusty - -cache: - directories: - - $HOME/.composer/cache - -matrix: - fast_finish: true - include: - - php: 7.3 - env: SYMFONY_VERSION=3.4.* - - php: 7.3 - env: SYMFONY_VERSION=4.3.* - - php: 7.3 - env: SYMFONY_VERSION=4.4.* - - php: 7.3 - env: SYMFONY_VERSION=5.0.* - -before_install: - - if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi - - if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; - -install: - - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; - - composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction - - ./vendor/bin/simple-phpunit install - -script: - - composer validate --strict --no-check-lock - - ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS diff --git a/README.md b/README.md index 3740538..b25b8b6 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ Requirements ============ * PHP 8.1 or higher -* Symfony 6.4, 7.4 or 8.x +* Symfony 6.4, 7.4 or 8.1+ (Symfony 8.0 is end-of-life and not supported) * Twig 3 -Using an older PHP or Symfony version? Stick to the `v1.3.x` releases (latest: `v1.3.3`). +Using an older PHP or Symfony version? Stick to the `1.x` releases (latest: `1.4.0`). Upgrading from 1.x? See [UPGRADE-2.0.md](UPGRADE-2.0.md). Installation diff --git a/Resources/doc/index.md b/Resources/doc/index.md index d622c2c..4a50b13 100644 --- a/Resources/doc/index.md +++ b/Resources/doc/index.md @@ -25,25 +25,42 @@ Example with the following context: **Note** Having different PHP versions is not possible and not recommended. -Configure your crons per env in your `config/packages/lexik_cron_file_generator.yaml`: - -``` yaml -lexik_cron_file_generator: - mailto: ~ # Send your command output to the list of emails - env_available: # declare your available environements - - staging # example: staging and prod - - prod - user: - staging: project_staging - prod: project_prod - php_version: php8.2 - absolute_path: - staging: path/to/staging/bin/console - prod: path/to/prod/bin/console - output_path: '%kernel.cache_dir%/cron_test' - crons: - - { name: 'Send email', command: 'app:test', env: { staging: '* * * * *', prod: '* 5 * * *' } } - +Configure your crons per env in your `config/packages/lexik_cron_file_generator.php`: + +``` php +extension('lexik_cron_file_generator', [ + 'mailto' => null, + 'env_available' => [ + 'staging', + 'prod', + ], + 'user' => [ + 'staging' => 'project_staging', + 'prod' => 'project_prod', + ], + 'php_version' => 'php8.2', + 'absolute_path' => [ + 'staging' => 'path/to/staging/bin/console', + 'prod' => 'path/to/prod/bin/console', + ], + 'output_path' => '%kernel.cache_dir%/cron_test', + 'crons' => [ + [ + 'name' => 'Send email', + 'command' => 'app:test', + 'env' => [ + 'staging' => '* * * * *', + 'prod' => '* 5 * * *', + ], + ], + ], + ]); +}; ``` As you can see you just have to configure your crons for each environment. diff --git a/Tests/Functional/app/AppKernel.php b/Tests/Functional/app/AppKernel.php index 2f092c8..5985128 100644 --- a/Tests/Functional/app/AppKernel.php +++ b/Tests/Functional/app/AppKernel.php @@ -52,6 +52,6 @@ protected function build(ContainerBuilder $container): void */ public function registerContainerConfiguration(LoaderInterface $loader): void { - $loader->load(sprintf(__DIR__.'/config/%s_config.yml', $this->config)); + $loader->load(sprintf(__DIR__.'/config/%s_config.php', $this->config)); } } diff --git a/Tests/Functional/app/config/base_config.php b/Tests/Functional/app/config/base_config.php new file mode 100644 index 0000000..08a19ba --- /dev/null +++ b/Tests/Functional/app/config/base_config.php @@ -0,0 +1,43 @@ +extension('framework', [ + 'secret' => 'test', + 'test' => true, + 'http_method_override' => false, + ]); + + $container->extension('twig', [ + 'strict_variables' => false, + 'default_path' => './Resources/views', + ]); + + $container->extension('lexik_cron_file_generator', [ + 'env_available' => [ + 'staging', + 'prod', + ], + 'user' => [ + 'staging' => 'project_staging', + 'prod' => 'project_prod', + ], + 'php_version' => 'php7.3', + 'absolute_path' => [ + 'staging' => 'path/to/staging', + 'prod' => 'path/to/prod', + ], + 'output_path' => '%kernel.cache_dir%/cron_test', + 'crons' => [ + [ + 'name' => 'send email', + 'command' => 'app:test', + 'env' => [ + 'staging' => '* * * * *', + 'prod' => '* 5 * * *', + ], + ], + ], + ]); +}; diff --git a/Tests/Functional/app/config/base_config.yml b/Tests/Functional/app/config/base_config.yml deleted file mode 100644 index df85402..0000000 --- a/Tests/Functional/app/config/base_config.yml +++ /dev/null @@ -1,24 +0,0 @@ -framework: - secret: test - test: ~ - http_method_override: false - -twig: - strict_variables: false - default_path: './Resources/views' - -lexik_cron_file_generator: - env_available: - - staging - - prod - user: - staging: project_staging - prod: project_prod - php_version: php7.3 - absolute_path: - staging: path/to/staging - prod: path/to/prod - output_path: '%kernel.cache_dir%/cron_test' - crons: - - { name: 'send email', command: 'app:test', env: { staging: '* * * * *', prod: '* 5 * * *' } } - diff --git a/Tests/Functional/app/config/empty_cron_config.php b/Tests/Functional/app/config/empty_cron_config.php new file mode 100644 index 0000000..7f508ae --- /dev/null +++ b/Tests/Functional/app/config/empty_cron_config.php @@ -0,0 +1,30 @@ +extension('framework', [ + 'secret' => 'test', + 'test' => true, + 'http_method_override' => false, + ]); + + $container->extension('twig', [ + 'strict_variables' => false, + 'default_path' => './Resources/views', + ]); + + $container->extension('lexik_cron_file_generator', [ + 'env_available' => [ + 'staging', + ], + 'user' => [ + 'staging' => 'project_staging', + ], + 'php_version' => 'php7.3', + 'absolute_path' => [ + 'staging' => 'path/to/staging', + ], + 'output_path' => '%kernel.cache_dir%/cron_test', + ]); +}; diff --git a/Tests/Functional/app/config/empty_cron_config.yml b/Tests/Functional/app/config/empty_cron_config.yml deleted file mode 100644 index 8cac18c..0000000 --- a/Tests/Functional/app/config/empty_cron_config.yml +++ /dev/null @@ -1,18 +0,0 @@ -framework: - secret: test - test: ~ - http_method_override: false - -twig: - strict_variables: false - default_path: './Resources/views' - -lexik_cron_file_generator: - env_available: - - staging - user: - staging: project_staging - php_version: php7.3 - absolute_path: - staging: path/to/staging - output_path: '%kernel.cache_dir%/cron_test' diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index f4a7781..79d3f8a 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -5,11 +5,14 @@ Requirements ------------ * PHP 8.1 or higher is required. -* Symfony 6.4, 7.4 or 8.x is required (support for Symfony 4.4, 5.4 and 6.0 to 6.3 is dropped). +* Symfony 6.4, 7.4 or 8.1+ is required (support for Symfony 4.4, 5.4, 6.0 to 6.3 + and 8.0 is dropped; Symfony 8.0 is end-of-life). * Twig 3 is required (support for Twig 2 is dropped), with a lower bound raised to a version without known security advisories. * Services are now loaded from PHP configuration files instead of XML ones. Service IDs and the `Lexik\Bundle\CronFileGeneratorBundle\Cron\DumpFile` alias are unchanged. +* Documentation examples now use PHP configuration files + (`config/packages/lexik_cron_file_generator.php`). Command ------- @@ -39,7 +42,8 @@ Command Dependency conflicts -------------------- -The `conflict` section of `composer.json` excludes versions of some transitive Symfony -dependencies (`symfony/cache`, `symfony/http-foundation`, `symfony/http-kernel`, -`symfony/routing`) affected by known security advisories. These bounds are revised -when new advisories are published; `composer audit` runs in the CI as a safeguard. +The `conflict` section of `composer.json` excludes versions of some Symfony dependencies +(`symfony/cache`, `symfony/config`, `symfony/filesystem`, `symfony/framework-bundle`, +`symfony/http-foundation`, `symfony/http-kernel`, `symfony/routing`) affected by known +security advisories. These bounds are revised when new advisories are published; +`composer audit` runs in the CI as a safeguard. diff --git a/composer.json b/composer.json index 3f6034a..dc2e4f1 100644 --- a/composer.json +++ b/composer.json @@ -12,21 +12,23 @@ ], "require": { "php": ">=8.1", - "symfony/console": "^6.4|^7.4|^8.0", - "symfony/framework-bundle": "^6.4|^7.4|^8.0", - "symfony/twig-bundle": "^6.4|^7.4|^8.0", + "symfony/console": "^6.4|^7.4|^8.1", + "symfony/framework-bundle": "^6.4|^7.4|^8.1", + "symfony/twig-bundle": "^6.4|^7.4|^8.1", "twig/twig": "^3.27" }, "require-dev": { - "symfony/phpunit-bridge": "^7.4|^8.0", - "symfony/yaml": "^6.4.45|^7.4.18|^8.1.6", - "symfony/var-dumper": "^6.4|^7.4|^8.0" + "symfony/phpunit-bridge": "^7.4|^8.1", + "symfony/var-dumper": "^6.4|^7.4|^8.1" }, "conflict": { - "symfony/cache": "<6.4.40|>=7.0,<7.4.12|>=8.0,<8.0.12", - "symfony/http-foundation": "<6.4.46|>=7.0,<7.4.19|>=8.0,<8.1.7", - "symfony/http-kernel": ">=7.4,<7.4.12|>=8.0,<8.0.12", - "symfony/routing": "<6.4.41|>=7.0,<7.4.13|>=8.0,<8.0.13" + "symfony/cache": "<6.4.40|>=7.0,<7.4.12", + "symfony/config": "<6.4.50|>=7.0,<7.4.23|>=8.0,<8.1.11", + "symfony/filesystem": "<6.4.50|>=7.0,<7.4.23|>=8.0,<8.1.11", + "symfony/framework-bundle": ">=7.4,<7.4.23|>=8.0,<8.1.11", + "symfony/http-foundation": "<6.4.50|>=7.0,<7.4.23|>=8.0,<8.1.11", + "symfony/http-kernel": "<6.4.50|>=7.0,<7.4.23|>=8.0,<8.1.11", + "symfony/routing": "<6.4.50|>=7.0,<7.4.23|>=8.0,<8.1.11" }, "autoload": { "psr-4": { "Lexik\\Bundle\\CronFileGeneratorBundle\\": "" },