kamilz / b2backblaze-bundle
Symfony bundle for B2 Cloud Storage
Installs: 40
Dependents: 0
Suggesters: 1
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.5.9
- kamilz/b2backblaze: >= 0.1.3
- symfony/framework-bundle: >= 2.0
Requires (Dev)
- phpunit/phpunit: 4.8.*
- symfony/yaml: *
Suggests
- sensio/buzz-bundle: Bundle around the Buzz HTTP client
This package is not auto-updated.
Last update: 2024-12-21 20:13:57 UTC
README
This bundle is a Symfony2 wrapper for b2backblaze library
About B2 Cloud Storage
B2 Cloud Storage is a cloud service for storing files in the cloud. Files are available for download at any time, either through the API or through a browser-compatible URL.
The documentation for B2 Cloud storage can be found at https://www.backblaze.com/b2/docs/.
Installation
The recommended way to install this bundle is through Composer.
Install Composer
curl -sS https://getcomposer.org/installer | php
Add B2BackblazeBundle as a dependency
php composer.phar require "kamilz/b2backblaze-bundle":"dev-master"
Enable the bundle in the kernel
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new KamilZ\B2BackblazeBundle\B2BackblazeBundle(),
// ...
);
}
Add required configuration
##config.yml
b2_backblaze:
account_id: YOUR_ID
account_key: YOUR_ACCCOUNT_SECRET_KEY
bucket_id: YOUR_BUCKET_ID
bucket_region: 'https://fxxx.backblaze.com/file/YOUR_BUCKET_NAME/'
timeout: 2000
Usage
Upload File:
<?php
(...)
$b2 = $this->get("backblaze.b2");
$b2->uploadFile("...test.png","test.png");
//or
$b2->uploadFileByContent($file,"test.png");
(...)
Twig image filter:
{# twig template #}
(..)
<img src="{{ app.user.avatar|b2 }}" alt="">
(..)
License
This bundle is under the MIT license. See the complete license in the bundle:
Resources/meta/LICENSE