PHPackages                             uploadcare/uploadcare-symfony2 - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. uploadcare/uploadcare-symfony2

ActiveLibrary[File &amp; Storage](/categories/file-storage)

uploadcare/uploadcare-symfony2
==============================

Official Uploadcare package for Symfony2

v1.0.1(12y ago)0961PHPPHP &gt;=5.3.0

Since Aug 15Pushed 6y ago15 watchersCompare

[ Source](https://github.com/uploadcare/uploadcare-symfony2)[ Packagist](https://packagist.org/packages/uploadcare/uploadcare-symfony2)[ Docs](https://github.com/uploadcare/uploadcare-symfony2)[ RSS](/packages/uploadcare-uploadcare-symfony2/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Uploadcare Symfony2 Bundle
==========================

[](#uploadcare-symfony2-bundle)

This is a bundle for [Symfony2](http://symfony.com/) to work with [Uploadcare](https://uploadcare.com/)

It's based on a [uploadcare-php](https://github.com/uploadcare/uploadcare-php) library.

Requirements
------------

[](#requirements)

- Symfony 2.1+
- PHP 5.3+
- php-curl

Install
-------

[](#install)

### GitHub

[](#github)

Clone bundle from git to your vendor directory:

```
git clone git://github.com/uploadcare/uploadcare-symfony2.git vendor/uploadcare/uploadcare-symfony2 --recursive

```

### Composer

[](#composer)

Update "require" section inside your composer.json:

```
"require": {
  "uploadcare/uploadcare-symfony2": "dev-master"
}

```

Now tell composer to download package:

```
php composer.phar update

```

Add fetch git submodules:

```
cd vendor/uploadcare/uploadcare-symfony2 && git init && git update

```

Edit your app/autoload.php. Add this:

```
$loader->add('Uploadcare', __DIR__.'/../vendor/uploadcare/uploadcare-symfony2/uploadcare/src');

```

Inside your app/config/config.yml add:

```
parameters:
    uploadcare.public_key: demopublickey
    uploadcare.secret_key: demoprivatekey

services:
    uploadcare:
      class: Uploadcare\UploadcareBundle\UploadcareSymfony
      arguments: [%uploadcare.public_key%, %uploadcare.secret_key%]

```

This will add Uploadcare Bundle as a service.

Usage
-----

[](#usage)

You can access this service inside a controller like this:

```
$this->get('uploadcare');

```

It will return a UploadcareSymfony object. This class extends Uploadcare\\Api class.

Create some entity:

```
namespace UploadcareTest\UploadcareTestBundle\Entity;

class UCFile
{
  public $file_id;
}

```

Create form inside your controller:

```
namespace UploadcareTest\UploadcareTestBundle\Controller;

use Uploadcare\UploadcareBundle\Form\Type\UploadcareWidgetType;

public function indexAction()
{
    $uc_file = new UCFile();
    $form = $this->createFormBuilder($uc_file)
                 ->add('file_id', new UploadcareWidgetType())
                 ->getForm();

    return $this->render('UploadcareTestBundle:Default:index.html.twig', array(
        'form' => $form->createView(),
        'uploadcare' => $this->get('uploadcare'),
    ));
}

```

You can see a UploadcareWidgetType. It's a hidden field with special parameters to activate widget

To display widget and forms create a view for controller:

```
{% extends '::base.html.twig' %}
{% block body %}

    {{ form_widget(form) }}

{% endblock %}
{% block javascripts %}
  {{ uploadcare.widget.getScriptTag|raw }}
{% endblock %}

```

Now you should be able to see a widget. Just upload some file and submit form.

To process file edit a controller to look like this:

```
public function indexAction()
{
    $uc_file = new UCFile();
    $form = $this->createFormBuilder($uc_file)
                 ->add('file_id', new UploadcareWidgetType())
                 ->getForm();

    $file = null;
    $request = $this->getRequest();
    if ($request->getMethod() == 'POST') {
      $form->bind($request);

      if ($form->isValid()) {
        $data = $request->request->get('form');
        $file_id = $data['file_id'];
        $file = $this->get('uploadcare')->getFile($file_id);
        $file->store();
      }
    }

    return $this->render('UploadcareTestBundle:Default:index.html.twig', array(
        'form' => $form->createView(),
        'uploadcare' => $this->get('uploadcare'),
        'file' => $file,
    ));
}

```

The main part is using a "getFile" method to create "$file" and then "store" method on file.

By calling "store" method you told Uploadcare to store file and it will be available at CDN.

You can pass "$file" to the twig template. "$file" is and object of Uploadcare\\File.

With use of this object you can call any operations with file and display the file inside template like this:

```
{{ file.resize(400, 400).getImgTag|raw }}

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4706d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/969216?v=4)[Maksim Chistyakov](/maintainers/grayhound)[@grayhound](https://github.com/grayhound)

---

Top Contributors

[![grayhound](https://avatars.githubusercontent.com/u/969216?v=4)](https://github.com/grayhound "grayhound (17 commits)")

### Embed Badge

![Health badge](/badges/uploadcare-uploadcare-symfony2/health.svg)

```
[![Health](https://phpackages.com/badges/uploadcare-uploadcare-symfony2/health.svg)](https://phpackages.com/packages/uploadcare-uploadcare-symfony2)
```

PHPackages © 2026

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