Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kazemmdev/media
Associate files with Eloquent models
https://github.com/kazemmdev/media
audio eloquent images laravel media php upload video
Last synced: 4 days ago
JSON representation
Associate files with Eloquent models
- Host: GitHub
- URL: https://github.com/kazemmdev/media
- Owner: kazemmdev
- License: mit
- Created: 2022-01-10T15:38:17.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-12T10:38:57.000Z (almost 3 years ago)
- Last Synced: 2024-04-17T15:07:09.351Z (7 months ago)
- Topics: audio, eloquent, images, laravel, media, php, upload, video
- Language: PHP
- Homepage:
- Size: 50.8 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Associate files with Eloquent models
[![Latest Version](https://img.shields.io/github/release/k90mirzaei/media.svg?style=flat-square)](https://github.com/k90mirzaei/media/releases)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/k90mirzaei/media/run-tests?label=tests)
[![Total Downloads](https://img.shields.io/packagist/dt/k90mirzaei/media.svg?style=flat-square)](https://packagist.org/packages/k90mirzaei/media)This package can associate all sorts of files with Eloquent models. It provides a
simple API to work with.Here are a few short examples of what you can do:
```php
$newsItem = News::find(1);
$newsItem->addMedia($pathToFile)->toMediaCollection('images');
```It can handle your uploads directly:
```php
$newsItem->addMedia($request->file('image'))->toMediaCollection('images');
```Want to store some large files on another filesystem? No problem:
```php
$newsItem->addMedia($smallFile)->toMediaCollection('downloads', 'local');
$newsItem->addMedia($bigFile)->toMediaCollection('downloads', 's3');
```The storage of the files is handled by [Laravel's Filesystem](https://laravel.com/docs/filesystem),
so you can use any filesystem you like. Additionally the package can create image manipulations
on images, audios and videos.## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Testing
You can run the tests with:
```bash
vendor/bin/phpunit
```## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.