PHP code example of geekcell / imagekit-bundle

1. Go to this page and download the library: Download geekcell/imagekit-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

geekcell / imagekit-bundle example snippets




return [
    // other bundles ...
    GeekCell\ImagekitBundle\GeekCellImagekitBundle::class => ['all' => true],
];

#[AsController]
class AvatarController extends AbstractController
{
    private Provider $avatarProvider;

    public function __construct(ProviderRegistry $registry)
    {
        $this->avatarProvider = $registry->getProvider('user_avatars');
    }

    #[Route('/avatar', name: 'avatar')]
    public function avatar()
    {
        $asset = $this->avatarProvider->provide('some-username.png');
        
        return new JsonResponse([
            'url' => $asset->getUrl(),
        ]);
    }
}