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
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build docs

on:
push:
branches: ['5.x']
branches: ['6.x']

jobs:
deploy:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/coding-standards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Coding Standards

on:
pull_request:
branches: ['5.x', '4.x', '3.x']
branches: ["*.x"]
push:
branches: ['5.x', '4.x', '3.x']
branches: ["*.x"]

jobs:
easy-coding-standard:
Expand All @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
php-version:
- '8.4'
- '8.5'

steps:
- name: Checkout code
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Continuous Integration

on:
pull_request:
branches: ['5.x', '4.x', '3.x']
branches: ["*.x"]
push:
branches: ['5.x', '4.x', '3.x']
branches: ["*.x"]

jobs:
phpunit:
Expand All @@ -17,18 +17,15 @@ jobs:
strategy:
matrix:
php-version:
- '8.2'
- '8.3'
- '8.4'
- '8.5'
symfony-version:
- '6.4.*'
- '7.4.*'
- '8.0.*'
include:
- php-version: '8.4'
symfony-version: '8.0.*'
- php-version: '8.5'
symfony-version: '8.0.*'
symfony-version: '8.1.*@dev'
continue-on-error: true

steps:
- name: Checkout code
Expand Down Expand Up @@ -56,4 +53,4 @@ jobs:

- name: Upload to Codecov
uses: codecov/codecov-action@v5
if: matrix.php-version == '8.2' && matrix.symfony-version == '6.4.*'
if: matrix.php-version == '8.4' && matrix.symfony-version == '7.4.*'
6 changes: 3 additions & 3 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Static Analysis

on:
pull_request:
branches: ['5.x', '4.x', '3.x']
branches: ["*.x"]
push:
branches: ['5.x', '4.x', '3.x']
branches: ["*.x"]

jobs:
phpstan:
Expand All @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
php-version:
- '8.4'
- '8.5'

steps:
- name: Checkout code
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG-6.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
6.0.0
-----

* Dropped support for PHP < 8.4
* Dropped support for Symfony 6.4 & Symfony < 7.4
* Upgraded dev dependencies
* Removed the PasswordStrength constraint, use the one from Symfony instead
* Removed PasswordStrengthChecker
* Dropped support for doctrine/orm v2
* Required Twig >= 3.23
* Removed support for endroid/qr-code < 6
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Leapt Core Bundle
=================

[![Package version](https://img.shields.io/packagist/v/leapt/core-bundle.svg?style=flat-square)](https://packagist.org/packages/leapt/core-bundle)
[![Build Status](https://img.shields.io/github/actions/workflow/status/leapt/core-bundle/continuous-integration.yaml?branch=5.x&style=flat-square)](https://github.com/leapt/core-bundle/actions?query=workflow%3A%22Continuous+Integration%22)
[![PHP Version](https://img.shields.io/packagist/php-v/leapt/core-bundle.svg?branch=5.x&style=flat-square)](https://travis-ci.org/leapt/core-bundle?branch=5.x)
[![Build Status](https://img.shields.io/github/actions/workflow/status/leapt/core-bundle/continuous-integration.yaml?branch=6.x&style=flat-square)](https://github.com/leapt/core-bundle/actions?query=workflow%3A%22Continuous+Integration%22)
[![PHP Version](https://img.shields.io/packagist/php-v/leapt/core-bundle.svg?branch=6.x&style=flat-square)](https://travis-ci.org/leapt/core-bundle?branch=6.x)
[![License](https://img.shields.io/badge/license-MIT-red.svg?style=flat-square)](LICENSE)
[![Code coverage](https://img.shields.io/codecov/c/github/leapt/core-bundle?style=flat-square)](https://codecov.io/gh/leapt/core-bundle/branch/5.x)
[![Code coverage](https://img.shields.io/codecov/c/github/leapt/core-bundle?style=flat-square)](https://codecov.io/gh/leapt/core-bundle/branch/6.x)

Introduction
------------
Expand Down Expand Up @@ -48,19 +48,20 @@ You can check docs there: https://core-bundle.leapt.dev/
Versions & dependencies
-----------------------

The current version (5.x) of the bundle works with Symfony 6.4, 7.0+ & 8.0+.
The current version (6.x) of the bundle works with Symfony 7.4 & 8.0+.
The project follows SemVer.
Only the last major version is maintained.

You can check the [changelog](CHANGELOG-5.x.md) for version 5 and the [upgrade document](UPGRADE-5.x.md) when upgrading
from 4.x bundle version.
You can check the [changelog](CHANGELOG-6.x.md) for version 6 and the [upgrade document](UPGRADE-6.x.md) when upgrading
from 5.x bundle version.

| CoreBundle version | Symfony version | PHP version |
|--------------------|-----------------|----------------|
| 5.x | ^6.4 \|\| ^7.0 | ^8.2 |
| 4.x | ^5.4 \|\| ^6.0 | ^8.0 |
| 3.1+ | ^4.4 \|\| ^5.0 | ^7.4 \|\| ^8.0 |
| 3.0 | ^4.4 \|\| ^5.0 | ^7.2 |
| CoreBundle version | Symfony version | PHP version |
|--------------------|--------------------------|----------------|
| 6.x | ^7.4 \|\| ^8.0 | ^8.4 |
| 5.x | ^6.4 \|\| ^7.0 \|\| ^8.0 | ^8.2 |
| 4.x | ^5.4 \|\| ^6.0 | ^8.0 |
| 3.1+ | ^4.4 \|\| ^5.0 | ^7.4 \|\| ^8.0 |
| 3.0 | ^4.4 \|\| ^5.0 | ^7.2 |

Contributing
------------
Expand Down
10 changes: 10 additions & 0 deletions UPGRADE-6.x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Upgrade guide for 6.0
---------------------

* Requires PHP 8.4+
* Requires Symfony 7.4/8.0+
* Removed the PasswordStrength constraint, use the one from Symfony instead
* Removed PasswordStrengthChecker
* Dropped support for doctrine/orm v2
* Requires Twig >= 3.23
* Removed support for endroid/qr-code < 6
50 changes: 25 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,34 @@
],
"minimum-stability": "stable",
"require": {
"php": "^8.2",
"doctrine/orm": "^2.10 || ^3.0",
"php": "^8.4",
"doctrine/orm": "^3.0",
"symfony/deprecation-contracts": "^3.5",
"symfony/event-dispatcher": "^6.4 || ^7.0 || ^8.0",
"symfony/form": "^6.4 || ^7.0 || ^8.0",
"symfony/framework-bundle": "^6.4 || ^7.0 || ^8.0",
"symfony/http-foundation": "^6.4 || ^7.0 || ^8.0",
"symfony/http-kernel": "^6.4 || ^7.0 || ^8.0",
"symfony/mime": "^6.4 || ^7.0 || ^8.0",
"symfony/routing": "^6.4 || ^7.0 || ^8.0",
"symfony/translation": "^6.4 || ^7.0 || ^8.0",
"symfony/twig-bundle": "^6.4 || ^7.0 || ^8.0",
"symfony/validator": "^6.4 || ^7.0 || ^8.0",
"twig/twig": "^3.0"
"symfony/event-dispatcher": "^7.4 || ^8.0",
"symfony/form": "^7.4 || ^8.0",
"symfony/framework-bundle": "^7.4 || ^8.0",
"symfony/http-foundation": "^7.4 || ^8.0",
"symfony/http-kernel": "^7.4 || ^8.0",
"symfony/mime": "^7.4 || ^8.0",
"symfony/routing": "^7.4 || ^8.0",
"symfony/translation": "^7.4 || ^8.0",
"symfony/twig-bundle": "^7.4 || ^8.0",
"symfony/validator": "^7.4 || ^8.0",
"twig/twig": "^3.23"
},
"require-dev": {
"doctrine/data-fixtures": "^1.6 || ^2.2",
"doctrine/persistence": "^3.2 || ^4.0",
"easycorp/easyadmin-bundle": "^4.8.5",
"endroid/qr-code": "^4.8 || ^5.0 || ^6.0",
"doctrine/persistence": "^4.0",
"easycorp/easyadmin-bundle": "^5.0.0",
"endroid/qr-code": "^6.0",
"fakerphp/faker": "^1.23",
"google/recaptcha": "^1.3",
"league/flysystem-bundle": "^3.0",
"phpstan/phpstan": "^2.1.22",
"phpstan/phpstan-deprecation-rules": "^2.0.3",
"phpunit/phpunit": "^11.5.35",
"symfony/browser-kit": "^6.4 || ^7.0 || ^8.0",
"symplify/easy-coding-standard": "^13.0.0"
"phpstan/phpstan": "^2.1.40",
"phpstan/phpstan-deprecation-rules": "^2.0.4",
"phpunit/phpunit": "^13.0.5",
"symfony/browser-kit": "^7.4 || ^8.0",
"symplify/easy-coding-standard": "^13.0.4"
},
"config": {
"sort-packages": true
Expand All @@ -63,10 +63,10 @@
"@phpstan",
"@phpunit"
],
"cs:dry": "vendor/bin/ecs",
"cs:fix": "vendor/bin/ecs --fix",
"phpstan": "vendor/bin/phpstan analyse --ansi",
"phpunit": "vendor/bin/phpunit --colors=auto"
"cs:dry": "@php vendor/bin/ecs",
"cs:fix": "@php vendor/bin/ecs --fix",
"phpstan": "@php vendor/bin/phpstan analyse --ansi",
"phpunit": "@php vendor/bin/phpunit --colors=auto"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion docs/form_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ If you don't know how to apply a form theme to your forms, [please check Symfony

!!! info

* Changed in v6.0.0: the FileField requires EasyAdmin bundle v5.0.0+.
* Added in v4.5.0: a FileField is available to use with EasyAdmin bundle. Requires EasyAdmin bundle v4.3.3+.
* Added in v4.11.0: `file_type_class` and `file_attr` options.

Expand All @@ -73,7 +74,8 @@ See also [File uploads](file_uploads.md).

!!! info

Added in v4.5.0: an ImageField is available to use with EasyAdmin bundle. Requires EasyAdmin bundle v4.3.3+.
* Changed in v6.0.0: the ImageField requires EasyAdmin bundle v5.0.0+.
* Added in v4.5.0: an ImageField is available to use with EasyAdmin bundle. Requires EasyAdmin bundle v4.3.3+.

## Recaptcha type

Expand Down
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ The Leapt Core bundle is a bundle used to help with some repetitive tasks, inclu
- [SEO-related tasks (sitemaps, etc)](sitemaps.md)
- [Twig extensions](twig_extensions.md)
- [Utilities](utilities.md)
- [Validators: PasswordStrength, Recaptcha, Slug](validators.md)
- [Validators: Recaptcha, Slug](validators.md)

If you find a bug or want to add a functionality,
[please create an issue or a pull request on Github](https://github.com/leapt/core-bundle)!
[please create an issue or a pull request on GitHub](https://github.com/leapt/core-bundle)!

## Examples

Expand All @@ -29,9 +29,9 @@ If you find a bug or want to add a functionality,

## Installation

This bundle requires PHP 8.2+.
This bundle requires PHP 8.4+.

As the bundle is compatible with Symfony 6.4/7.0+/8.0+ and Symfony Flex, the only thing you have to do
As the bundle is compatible with Symfony 7.4/8.0+ and Symfony Flex, the only thing you have to do
is requiring the package with composer:

```bash
Expand Down
19 changes: 0 additions & 19 deletions docs/utilities.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
# Utilities

## PasswordStrengthChecker

This class has only one method: `getStrength`, and returns the strength of a given password (between 0 and 100,
100 being the best value).

If the second argument - `$username` - is provided, the method will remove the username from the password
if it contains it.

See also the [PasswordStrength constraint](validators.md#passwordstrength).

!!! example "Usage"

```php
use Leapt\CoreBundle\Util\PasswordStrengthChecker;

$passwordStrengthChecker = new PasswordStrengthChecker();
$score = $passwordStrengthChecker->getStrength($password, $username);
```

## StringUtil

The StringUtil has 4 public & static methods, their names speak for themselves:
Expand Down
24 changes: 0 additions & 24 deletions docs/validators.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
# Validator Constraints

## PasswordStrength

The PasswordStrengthChecker is based on a snipped provided in Symfony 1.

!!! example "Usage"

```php
use Leapt\CoreBundle\Validator\Constraints as LeaptAssert;

#[LeaptAssert\PasswordStrength(min: 6, max: 72, score: 80')]
public string $plainPassword;
```

??? info "Options"

| Name | Description | Default value |
| ---- | ----------- | ------------- |
| min | Minimum length for the password. | null |
| max | Maximum length for the password. | null |
| score | Required strength to pass validation, between 0 and 100. | 50 |
| minMessage | Message shown if the password is too short. | This password is too short. It should have {{ limit }} characters or more. |
| maxMessage | Message shown if the password is too long. | This password is too long. It should have {{ limit }} characters or less. |
| scoreMessage | Message shown if the password is not strong enough. | This password is not strong enough. |

## Recaptcha

This validator should be used with the [Recaptcha Type](form_types.md#recaptcha-type), and is based on the
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ site_description: Documentation for leapt/core-bundle

repo_name: leapt/core-bundle
repo_url: https://github.com/leapt/core-bundle
edit_uri: https://github.com/leapt/core-bundle/edit/4.x/docs/
edit_uri: https://github.com/leapt/core-bundle/edit/6.x/docs/

theme:
name: material
Expand Down
12 changes: 0 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ parameters:
count: 1
path: src/Twig/Extension/PaginatorExtension.php

-
rawMessage: 'Call to function method_exists() with ''Endroid\\QrCode\\Builder\\Builder'' and ''create'' will always evaluate to false.'
identifier: function.impossibleType
count: 1
path: src/Twig/Extension/QrCodeExtension.php

-
rawMessage: '''
Call to deprecated method getExpressionParser() of class Twig\Parser:
Expand Down Expand Up @@ -138,12 +132,6 @@ parameters:
count: 3
path: src/Twig/TokenParser/PaginatorThemeTokenParser.php

-
rawMessage: 'Method Symfony\Component\Validator\Constraints\Regex::__construct() invoked with 8 parameters, 1-7 required.'
identifier: arguments.count
count: 1
path: src/Validator/Constraints/Slug.php

-
rawMessage: 'Method Leapt\CoreBundle\Tests\LeaptCoreTestingKernel::configureContainer() is unused.'
identifier: method.unused
Expand Down
5 changes: 3 additions & 2 deletions src/EasyAdmin/Field/FileField.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
use Leapt\CoreBundle\Form\Type\FileType;
use Symfony\Contracts\Translation\TranslatableInterface;

final class FileField implements FieldInterface
{
Expand All @@ -16,9 +17,9 @@ final class FileField implements FieldInterface
public const OPTION_ALLOW_DOWNLOAD = 'allowDownload';
public const OPTION_FILE_PATH = 'filePath';

public static function new(string $propertyName, ?string $label = null): self
public static function new(string $propertyName, TranslatableInterface|string|bool|null $label = null): self
{
return (new self())
return new self()
->setProperty($propertyName)
->setLabel($label)
->setTemplateName('crud/field/text')
Expand Down
Loading