Download the PHP package diecoding/yii2-aws-s3 without Composer

On this page you can find all versions of the php package diecoding/yii2-aws-s3. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-aws-s3

Yii2 AWS S3

Amazon S3 or Amazon Simple Storage Service component for Yii2.

Latest Stable Version Total Downloads Latest Stable Release Date Quality Score Build Status License PHP Version Require

Yii2 AWS S3 uses SemVer.

Table of Contents

Instalation

Package is available on Packagist, you can install it using Composer.

or add to the require section of your composer.json file.

Dependencies

Configuration

  1. Add the component to config/main.php

Usage

Basic Usage

Advanced Usage

Custom Commands

Commands have two types: plain commands that's handled by the PlainCommandHandler and commands with their own handlers. The plain commands wrap the native AWS S3 commands.

The plain commands must implement the PlainCommand interface and the rest must implement the Command interface. If the command doesn't implement the PlainCommand interface, it must have its own handler.

Every handler must extend the Handler class or implement the Handler interface. Handlers gets the S3Client instance into its constructor.

The implementation of the HasBucket and HasAcl interfaces allows the command builder to set the values of bucket and acl by default.

To make the plain commands asynchronously, you have to implement the Asynchronous interface. Also, you can use the Async trait to implement this interface.

Consider the following command:

The handler for this command looks like this:

And usage this command:

Custom plain command looks like this:

Any command can extend the ExecutableCommand class or implement the Executable interface that will allow to execute this command immediately: $command->withSomething('some value')->execute();.

Using Traits

Model Trait

Attach the Trait to the Model/ActiveRecord with some media attribute that will be saved in S3:

Override the attributePaths() method to change the base path where the files will be saved on AWS S3.

Using Trait Methods

Overriding Trait Methods

getS3Component

The S3MediaTrait depends on this component to be configured. The default configuration is to use this component on index 's3', but you may use another value. For this cases, override the getS3Component() method:

attributePaths

The main method to override is attributePaths(), which defines a path in S3 for each attribute of yout model. Allowing you to save each attribute in a different S3 folder.

Here an example:

getPresignedUrlDuration

The default pressigned URL duration is set to "+5 Minutes", override this method and use your own expiration.

The value should be a valid PHP datetime operation. Read PHP documentation for details

isSuccessResponseStatus

The isSuccessResponseStatus() method validate the AWS response for status codes is 2**. If needed, you can override this validation:


Read more docs: https://sugengsulistiyawan.my.id/docs/opensource/yii2/aws-s3/


All versions of yii2-aws-s3 with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
yiisoft/yii2 Version ~2.0
aws/aws-sdk-php Version ~3.263
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package diecoding/yii2-aws-s3 contains the following files

Loading the files please wait ....