Skip to content

New features and FlySystem V2 Support.

Compare
Choose a tag to compare
@Warxcell Warxcell released this 15 Jan 16:36
· 312 commits to master since this release

Files is now supporting FlySystem V2. https://flysystem.thephpleague.com/v2/docs/what-is-new/

New features:
PathResolvers - Transforms Files to web browser path. Few built-in resolvers exists as per this release:

  • AssetsPathResolver - uses The Asset Component
  • AwsS3PathResolver - uses Amazon AWS S3 Client to generate paths.
  • SymfonyCachePathResolver - decorator that uses Symfony Cache to cache response from decorated resolver, so next time it will not call it.

DirectoryPrefixStrategy - decorator that prefixes directory.

BC Breaks:
getDirectory() in NamingStrategy is now optional. Return type should be now ?string.
FileType form now uses internally 'file' field to handle files, instead extending FileType. This allows you to add custom fields for Files in forms.

$formMapper->add(
    'image',
    FileType::class,
    [
        'required' => false,
        'constraints' => [ConstraintsOnEntity]
        'input_options' => [
            'attr' => [
                'accept' => 'image/*',
            ],
            'constraints' => [
                   SymfonyConstraintsOnFiles
            ]
        ],
    ]
);

Introduces ManagerInterface - from now on use this interface for type-hints.