دوگون کام / آپلود باندل
آپلود باندلی برای دوگون کام و آننیسن کام
2.1.0
2018-04-26 07:23 UTC
Requires
- php: ^7.1.3
- aws/aws-sdk-php-symfony: ~2.0
- guzzlehttp/guzzle: ~6.1
- symfony/http-kernel: ~4.0
Requires (Dev)
- doctrine/annotations: 1.3.*
- intervention/image: ^2.3
- phpunit/phpunit: ~5.6
- symfony/framework-bundle: ~2.7|~3.1
- symfony/var-dumper: ~2.8|~3.2
This package is not auto-updated.
Last update: 2024-09-14 18:47:29 UTC
README
1: بارگیری باندل
شما میتوانید دوگون کام/آپلود باندل را به لیست نیازهای خود با dev-master اضافه کنید
"duguncom/uploadbundle": "~2.0",
یا شما میتوانید مستقیماً اجرا کنید
composer require duguncom/uploadbundle
2: فعالسازی باندل
باندل را به لیست باندلهای ثبتشده خود در فایل app/AppKernel.php
اضافه کنید
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Dugun\UploadBundle\DugunUploadBundle(), ); // ... } // ... }
3: تنظیمات
پارامترهای تنظیمات مورد نیاز ما را به فایل app/config/config.yml
خود اضافه کنید
dugun_upload: upload_service_name: %dugun_upload.upload_service_name% # choose your side temporary_path: %dugun_upload.temporary_path% # give a folder path that web-server has access to write (maybe /tmp is good) credentials: aws: base_url: %dugun_upload.credentials.aws.base_url% bucket: %dugun_upload.credentials.aws.bucket% version: latest region: %dugun_upload.credentials.aws.region% scheme: http credentials: key: %dugun_upload.credentials.aws.credentials.key% secret: %dugun_upload.credentials.aws.credentials.secret%
4: استفاده
شما میتوانید از upload_service در کنترلهای خود با گرفتن از مخزن استفاده کنید یا میتوانید سرویس را به خدمات دیگر خود بپاسخ دهید.
Service naming: dugun_upload.service.dugun_upload
####آپلود فایل
$file = 'It can be path of a file';
$file = 'OR It can be UploadedFile instance';
$file = 'OR It can be \Intervention\Image\Image instance';
$destinationPath = '/uploaded/folder/filename.jpg';
$result = $this->uploadService->upload($file, $destinationPath);
//If file uploaded successfully, $result['success'] returns as (boolean)true
//And if its true, it returns $result['file_url'] that you can access your file