PHPackages                             azaw/easyadmin-az-fields - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. azaw/easyadmin-az-fields

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

azaw/easyadmin-az-fields
========================

Custom EasyAdmin fields by AZ

v1.4.2(3mo ago)0136↓93.3%MITPHPPHP &gt;=8.3

Since Jul 30Pushed 3mo agoCompare

[ Source](https://github.com/AlbertZawadzki/easyadmin_az_fields)[ Packagist](https://packagist.org/packages/azaw/easyadmin-az-fields)[ RSS](/packages/azaw-easyadmin-az-fields/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (12)Versions (14)Used By (0)

Easy admin az fields
====================

[](#easy-admin-az-fields)

Available fields
----------------

[](#available-fields)

- [CropField](#cropfield)
- [CoordinatesField](#coordinatesfield)
- [RichEditorField](#richEditorField)

CropField
---------

[](#cropfield)

Used for cropping images. If not image file provided, it will be left alone but still uploadable.

### Field usage in CRUD

[](#field-usage-in-crud)

```
CropField::new('backgroundImage', "")
    ->setRequired(false)
    ->setFormType(FileForm::class)
    ->setFormTypeOption(
        CropType::OPTION_CROPPER_SETTINGS,
        new CropperSettingsDto()
            ->setAspectRatio(16 / 10)
    ),
```

### Example CropDataTransformer:

[](#example-cropdatatransformer)

```
namespace App\DataTransformer;

use App\Entity\File;
use App\Interfaces\FileManagerInterface;
use EasyAdminAzFields\Contracts\CropDataTransformerInterface;
use EasyAdminAzFields\Dto\CropperValueDto;
use RuntimeException;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class FileDataTransformer implements CropDataTransformerInterface
{
    public function __construct(
        private readonly FileManagerInterface $fileManager
    )
    {
    }

    public function transform(mixed $value): CropperValueDto
    {
        $dto = new CropperValueDto();

        if (!$value instanceof File) {
            return $dto->setOldImage($value);
        }

        return $dto
            ->setOldImage($value->getUrl());
    }

    public function reverseTransform(mixed $value): ?string
    {
        if (!$value instanceof CropperValueDto) {
            return null;
        }

        if (!$value->getImage()) {
            return $value->getOldImage();
        }

        $tempPath = $value->getImage();
        $uploaded = new UploadedFile($tempPath, 'tempfile', null, null, true);
        $extension = $uploaded->guessExtension();
        // Your file name
        $randomFileName = "random" . rand();

        // Full path where you want to upload the file
        $uploadPath = "/{$randomFileName}.{$extension}";

        // Saves file
        $uploaded = $this->fileManager->save($uploadPath, $uploaded->getContent());
        if (!$uploaded) {
            throw new RuntimeException("Failed to upload the file");
        }

        // The image path which will be passed to entity
        // You can return whatever you want it will be set into your entity
        return $this->fileManager->getFullPath($uploadPath);
    }
}
```

### Need more help how to use it?

[](#need-more-help-how-to-use-it)

Need more data than just single field? Enjoy my form for entity "File".
The entity has 3 fields: `name`, `alt` and `url`.

```
namespace App\Form;

use App\DataTransformer\FileDataTransformer;
use App\Entity\File;
use Doctrine\ORM\EntityManagerInterface;
use EasyAdminAzFields\Dto\CropperSettingsDto;
use EasyAdminAzFields\Form\CropType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\OptionsResolver\OptionsResolv

class FileForm extends AbstractType
{
    public function __construct(
        private readonly EntityManagerInterface $em,
        private readonly FileDataTransformer    $fileDataTransformer,
    )
    {
    }

    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('name', TextType::class, [
                'label' => 'Name',
            ])
            ->add('alt', TextType::class, [
                'label' => 'Alt',
                'required' => false,
            ])
            ->add('url', CropType::class, [
                'label' => 'File',
                CropType::OPTION_DATA_TRANSFORMER => $options[CropType::OPTION_DATA_TRANSFORMER],
                CropType::OPTION_CROPPER_SETTINGS => $options[CropType::OPTION_CROPPER_SETTINGS],
            ])->addEventListener(
                FormEvents::SUBMIT,
                function (FormEvent $event) {
                    $data = $event->getData();

                    if (!$data instanceof File) {
                        return;
                    }

                    if ($data->getUrl()) {
                        return;
                    }

                    $event->setData(null);
                    $this->em->detach($data);
                }
            );
    }

    public function configureOptions(OptionsResolver $resolver): void
    {
        $resolver->setDefaults([
            'class' => File::class,
            'data_class' => File::class,
            'query_builder' => null,
            CropType::OPTION_CROPPER_SETTINGS => new CropperSettingsDto(),
            CropType::OPTION_DATA_TRANSFORMER => $this->fileDataTransformer,
        ])->setAllowedTypes(
            CropType::OPTION_CROPPER_SETTINGS,
            [
                CropperSettingsDto::class
            ]
        )->setAllowedTypes(
            CropType::OPTION_DATA_TRANSFORMER,
            [
                DataTransformerInterface::class
            ]
        );
    }
}
```

CoordinatesField
----------------

[](#coordinatesfield)

Used for coordinates inside your entity. Values are under `{fieldName}_latitude` and `{fieldName}_longitude`.

### Field usage in CRUD

[](#field-usage-in-crud-1)

```
CoordinatesField::new('coordinates', "Geo location");
```

### Add coordinates to your entity (YourEntity)

[](#add-coordinates-to-your-entity-yourentity)

```
use EasyAdminAzFields\Entity\Coordinates;

#[ORM\Entity(repositoryClass: YourEntityRepository::class)]
class YourEntity
{
    #[ORM\Embedded(class: Coordinates::class)]
    private ?Coordinates $coordinates;

    public function __construct()
    {
        $this->coordinates = new Coordinates();
    }

    public function getCoordinates(): ?Coordinates
    {
        return $this->coordinates;
    }

    public function setCoordinates(?Coordinates $coordinates): static
    {
        $this->coordinates = $coordinates;

        return $this;
    }
}
```

RichEditorField
---------------

[](#richeditorfield)

Used as an html editor. TinyMCE in version 5.1.1 is used.
By using this package you automatically selfhost TinyMCE.

### Field usage in CRUD

[](#field-usage-in-crud-2)

```
RichEditorField::new('content', "HTML content");
```

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance82

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Recently: every ~4 days

Total

13

Last Release

94d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.0

v1.3.0PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49951334?v=4)[Albert Zawadzki](/maintainers/AlbertZawadzki)[@AlbertZawadzki](https://github.com/AlbertZawadzki)

---

Top Contributors

[![AlbertZawadzki](https://avatars.githubusercontent.com/u/49951334?v=4)](https://github.com/AlbertZawadzki "AlbertZawadzki (6 commits)")

### Embed Badge

![Health badge](/badges/azaw-easyadmin-az-fields/health.svg)

```
[![Health](https://phpackages.com/badges/azaw-easyadmin-az-fields/health.svg)](https://phpackages.com/packages/azaw-easyadmin-az-fields)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M737](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k17.8k](/packages/prestashop-prestashop)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
