Skip to content
Merged
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
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
55 changes: 36 additions & 19 deletions Resources/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?php

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $container): void {
$container->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.
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
43 changes: 43 additions & 0 deletions Tests/Functional/app/config/base_config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $container): void {
$container->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 * * *',
],
],
],
]);
};
24 changes: 0 additions & 24 deletions Tests/Functional/app/config/base_config.yml

This file was deleted.

30 changes: 30 additions & 0 deletions Tests/Functional/app/config/empty_cron_config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $container): void {
$container->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',
]);
};
18 changes: 0 additions & 18 deletions Tests/Functional/app/config/empty_cron_config.yml

This file was deleted.

14 changes: 9 additions & 5 deletions UPGRADE-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down Expand Up @@ -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.
22 changes: 12 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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\\": "" },
Expand Down
Loading