limit0/assets-bundle

Implements image upload support for projects utilizing limit0/assets

Installs: 254

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

Type:symfony-bundle

v1.0 2017-03-07 18:01 UTC

This package is not auto-updated.

Last update: 2024-04-14 00:12:33 UTC


README

Implements image upload support for projects utilizing limit0/assets

Requirements

  • You need an AWS account with access to an S3 bucket, or
  • You need write access via your web server user to a path for local storage.

Installation

Install the package via composer:

composer require limit0/assets-bundle

Include the bundle in your AppKernel.php:

    public function registerBundles()
    {
        $bundles = [
            // ...
            new Limit0\AssetsBundle\Limit0AssetsBundle(),
            // ...

Configuration

Configure the bundle using your preferred asset storage provider. Full possible configuration is listed below:

limit0_assets:
    engine: aws_s3                              # Either `aws_s3` or `local_storage`
    http_prefix: //my-cdn.io/path-to-images/    # A URL prefix for your uploaded images. Can be relative.
    # The URL provided by the uploader will prefix the filename with this path, so they can be viewed.
    aws_s3:
        region: us-east-1                       # Default S3 storage region
        acl: public-read                        # Default ACL for uploaded files
        bucket: mybucket                        # Bucket to upload files to
    local_storage:
        path: /uploads/myproject                # Path on server to upload files to. Can be relative.

If using AWS S3, bucket is required. If using local storage, path is required.

Routing

You will need to import this bundle's routing. To prevent any potential collision issues, be sure to load it any other application routes:

limit0_assets:
    resource: "@Limit0AssetsBundle/Resources/config/routing.yml"
    prefix:   /

app_bundle:
    resource: "@AppBundle/Resources/config/routing.yml"
# ...