Download the PHP package djurovicigoor/lara-files without Composer

On this page you can find all versions of the php package djurovicigoor/lara-files. 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 lara-files

LaraFiles

Latest Version on Packagist Total Downloads License: MIT Scrutinizer code quality (GitHub/Bitbucket) Scrutinizer build (GitHub/Bitbucket)

Lara-files is a package which will make it easier to work with files. Package has built-in support for DigitalOcean spaces and Amazon S3. This package can be used in Laravel 5.5 or higher.

lara-files preview

Installation

You can install the package via composer:

The service provider will automatically get registered. Or you may manually add the service provider in your config/app.php file:

Now you can publish a service provider:

After the config file and migration has been published, you can change default visibility in config/lara-files.php config file if you want:

After that you can create the lara-files table by running the migrations:

LaraFile model and Database schema

The LaraFile model provides one MorphToMany relation by default. If you want to use more than default laraFile() relation, you should modify types array in config/lara-files.php

You can modify this array as you want, add or remove an item. In this example, I have 3 types. For each of those types, package created for you relations between your model and LaraFile model, by default.

If I use an avatar for this example, you have the next relations and properties on your model:

Also, you have lazy loaded relations avatar and avatars that are doing the same thing as getAvatar() and getAvatars() methods.

All of those methods and properties are applicable for any type in this types array.

Database schema:

Usage

Before you start using the package, you have to check your config/filesystems.php file and set correct disk drivers. Package support next drivers: 'local' , 'public' , 'DOSpaces' , 'Amazon S3'. Below is an example of correct disk drivers.

When you setup disk drivers, add the DjurovicIgoor\LaraFiles\Traits\LaraFileTrait trait to your model(s):

After you successfully set disk drivers you have to run php artisan storage:link to link your storage/app/public with public/storage folder if you want to access files through browser who has 'public' driver or visibility. Now, you have prepared Eloquent Model for using Trait function:

Trait functions

All functions can be called on an already stored model in the database. The first parameter of all functions is disk adapter one of which you already have defined in your config/filesistems.php.

The second parameter is explained for each function in the section below.

The third parameter of all functions is a type of file, that is some kind of category. You can pass anything for this parameter only has to be in string format. Later, all files can be categorized by these parameters.

The fourth parameter of all functions is $additionalParameters variable, and should be key => value array.

Every item of the above array is optional. If you want, you can pass an empty array.

uploadHttpFile()

With this function, you can upload a single HttpUploadedFile file and associate it with your model.

uploadHttpFiles()

With this function, you can upload the array of HttpUploadedFile files and associate them with your model.

uploadBase64File()

With this function, you can upload a single base64 file and associate it with your model.

uploadBase64Files()

With this function, you can upload the array of base64 files and associate them with your model. `

Change log

Please see the changelog.md for more information on what has changed recently.

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Donate

If you found this project helpful or you learned something from the source code and want to appreciate

Credits

Contributors

Name Changes Date
@niladam Refactor to PSR2 and simplify accessor pull request #2 2019-05-18
@chefe Fix typo in exception message pull request #5 2019-05-23
@omly97 Laravel 10 - Fix - Error Call to undefined function str_plural pull request #6 2023-08-17

License

MIT. Please see the license file for more information.


All versions of lara-files with dependencies

PHP Build Version
Package Version
Requires league/flysystem-aws-s3-v3 Version ^1.0|^2.0|^3.0
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 djurovicigoor/lara-files contains the following files

Loading the files please wait ....