Download the PHP package rootinc/laravel-s3-file-model without Composer
On this page you can find all versions of the php package rootinc/laravel-s3-file-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-s3-file-model
Laravel S3 File Model
Provides a File Model that supports direct uploads / downloads from S3 for a Laravel App.
Installation
composer require rootinc/laravel-s3-file-model
- Run
php artisan vendor:publish --provider="RootInc\LaravelS3FileModel\FileModelServiceProvider"
to createFile
model inapp
,FileTest
intests\Unit
,FileFactory
indatabase\factories
,2020_03_12_152841_create_files_table
indatabase\migrations
, andFileController
inapp\Http\Controllers
- Run
php artisan vendor:publish --provider="Aws\Laravel\AwsServiceProvider
which addsaws.php
in theconfig
folder - In the
aws.php
file, change'region' => env('AWS_REGION', 'us-east-1'),
to useAWS_DEFAULT_REGION
- In
config\filesystems.php
, add key'directory' => '', // root dir
topublic
and add key'directory' => env('AWS_UPLOAD_FOLDER'),
tos3
-
In
tests\TestCase
, add this function: - Update routing. We can use this as an example:
Route::apiResource('files', 'FileController')->only(['index', 'store', 'update', 'destroy']);
- :tada:
Update from 0.1. to 0.2.
If we are using API versioning paradigm, 0.2.* lets us abstract the file model so that in a child class, we can import a different version of the File.
For example, our FileController
would look something like this:
Now when running the parent's functionality, it will make use of the right model.
Note -- the FileController's update
and delete
methods have been switched from public function method(Request $request, File $file)
to public function method(Request $request, $file_id)
The same has been updated for tests. That way, if we want to make use of Laravel 8's updated factory classes, we can do so like below:
Example React FileUploader
Contributing
Thank you for considering contributing to the Laravel S3 File Model! To encourage active collaboration, we encourage pull requests, not just issues.
If you file an issue, the issue should contain a title and a clear description of the issue. You should also include as much relevant information as possible and a code sample that demonstrates the issue. The goal of a issue is to make it easy for yourself - and others - to replicate the bug and develop a fix.
License
The Laravel S3 File Model is open-sourced software licensed under the MIT license.
All versions of laravel-s3-file-model with dependencies
laravel/framework Version >=9
maltyxx/images-generator Version ^1
aws/aws-sdk-php-laravel Version ^3
league/flysystem-aws-s3-v3 Version ^3